|
| 1 | +name: termux-release-checkpoint |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + source_branch: |
| 7 | + description: "Release branch to checkpoint from, for example release/0.123.0" |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: "" |
| 11 | + source_sha: |
| 12 | + description: "Specific source commit SHA to checkpoint; defaults to the source branch tip" |
| 13 | + required: false |
| 14 | + type: string |
| 15 | + default: "" |
| 16 | + destination_branch: |
| 17 | + description: "Destination patch branch to receive the checkpoint PR" |
| 18 | + required: false |
| 19 | + type: string |
| 20 | + default: "wallentx/termux-target" |
| 21 | + reviewer: |
| 22 | + description: "GitHub username to request as reviewer" |
| 23 | + required: false |
| 24 | + type: string |
| 25 | + default: "wallentx" |
| 26 | + |
| 27 | +permissions: |
| 28 | + actions: read |
| 29 | + attestations: read |
| 30 | + checks: read |
| 31 | + contents: read |
| 32 | + deployments: read |
| 33 | + issues: read |
| 34 | + discussions: read |
| 35 | + packages: read |
| 36 | + pages: read |
| 37 | + pull-requests: read |
| 38 | + repository-projects: read |
| 39 | + statuses: read |
| 40 | + |
| 41 | +concurrency: |
| 42 | + group: termux-release-checkpoint-${{ inputs.source_branch || github.ref_name }} |
| 43 | + cancel-in-progress: false |
| 44 | + |
| 45 | +jobs: |
| 46 | + checkpoint: |
| 47 | + runs-on: ubuntu-slim |
| 48 | + permissions: |
| 49 | + contents: write |
| 50 | + issues: write |
| 51 | + pull-requests: write |
| 52 | + env: |
| 53 | + GH_REPO: ${{ github.repository }} |
| 54 | + DESTINATION_BRANCH: ${{ inputs.destination_branch || 'wallentx/termux-target' }} |
| 55 | + REVIEWER: ${{ inputs.reviewer || 'wallentx' }} |
| 56 | + REQUESTED_SOURCE_BRANCH: ${{ inputs.source_branch }} |
| 57 | + REQUESTED_SOURCE_SHA: ${{ inputs.source_sha }} |
| 58 | + steps: |
| 59 | + - name: Generate GitHub App token |
| 60 | + id: app-token |
| 61 | + uses: actions/create-github-app-token@v3 |
| 62 | + with: |
| 63 | + client-id: ${{ vars.APP_CLIENT_ID }} |
| 64 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 65 | + |
| 66 | + - name: Checkout release branch |
| 67 | + uses: actions/checkout@v6 |
| 68 | + with: |
| 69 | + fetch-depth: 0 |
| 70 | + ref: ${{ inputs.source_branch || github.ref_name }} |
| 71 | + token: ${{ steps.app-token.outputs.token }} |
| 72 | + |
| 73 | + - name: 🧰 Actions Toolbox |
| 74 | + # This is required for the GitHub CLI |
| 75 | + env: |
| 76 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 77 | + uses: wallentx/gh-actions/composite/actions-toolbox@main |
| 78 | + |
| 79 | + - name: Configure git |
| 80 | + shell: bash |
| 81 | + env: |
| 82 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 83 | + run: | |
| 84 | + set -euo pipefail |
| 85 | + git config user.name "github-actions[bot]" |
| 86 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 87 | + source_branch="${REQUESTED_SOURCE_BRANCH:-${GITHUB_REF_NAME}}" |
| 88 | + git fetch --prune origin "${DESTINATION_BRANCH}" "${source_branch}" |
| 89 | +
|
| 90 | + - name: Create checkpoint PR |
| 91 | + shell: bash |
| 92 | + env: |
| 93 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 94 | + run: | |
| 95 | + scripts/termux-create-checkpoint-pr.sh |
0 commit comments