Workflows: Replace ISSUES_BOT_TOKEN with GitHub App for labeling + 'against release' auto comment (#4621) * ci: replace ISSUES_BOT_TOKEN with GitHub App authentication for PR auto-labeling workflow * Update PR auto comments for target branch guidance Added note about changing target branch for PRs. --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -41,6 +41,16 @@ labels: | |||
| 41 | π¬ This PR needs testing! | 41 | π¬ This PR needs testing! |
| 42 | Any contributor can test and leave reviews, so feel free to help us out! | 42 | Any contributor can test and leave reviews, so feel free to help us out! |
| 43 | 43 | ||
| 44 | - name: β Against Release Branch | ||
| 45 | labeled: | ||
| 46 | pr: | ||
| 47 | body: > | ||
| 48 | β This PR is against the `release` branch. | ||
| 49 | |||
| 50 | Please make sure this was intended, and you did not want to target the `staging` branch. Only hotfixes, readme changes and similar should be made against `release`. | ||
| 51 | |||
| 52 | You can change the target branch **without recreating the PR** by clicking "Edit" at the top of the page. | ||
| 53 | |||
| 44 | - name: π₯ ⬀⬀⬀⬀⬀ | 54 | - name: π₯ ⬀⬀⬀⬀⬀ |
| 45 | labeled: | 55 | labeled: |
| 46 | pr: | 56 | pr: |
| @@ -12,6 +12,25 @@ permissions: | |||
| 12 | pull-requests: write | 12 | pull-requests: write |
| 13 | 13 | ||
| 14 | jobs: | 14 | jobs: |
| 15 | app-auth: | ||
| 16 | name: π Mint App token | ||
| 17 | runs-on: ubuntu-latest | ||
| 18 | if: always() | ||
| 19 | |||
| 20 | outputs: | ||
| 21 | app_token: ${{ steps.app.outputs.token }} | ||
| 22 | |||
| 23 | steps: | ||
| 24 | - name: Create GitHub App Token | ||
| 25 | # Create a GitHub App token | ||
| 26 | # https://github.com/marketplace/actions/create-github-app-token | ||
| 27 | uses: actions/create-github-app-token@v2 | ||
| 28 | id: app | ||
| 29 | with: | ||
| 30 | app-id: ${{ vars.ST_BOT_APP_ID }} | ||
| 31 | private-key: ${{ secrets.ST_BOT_SECRET }} | ||
| 32 | owner: ${{ github.repository_owner }} | ||
| 33 | |||
| 15 | run-eslint: | 34 | run-eslint: |
| 16 | name: β Check ESLint on PR | 35 | name: β Check ESLint on PR |
| 17 | runs-on: ubuntu-latest | 36 | runs-on: ubuntu-latest |
| @@ -59,7 +78,7 @@ jobs: | |||
| 59 | label-by-size: | 78 | label-by-size: |
| 60 | name: π·οΈ Label PR by Size | 79 | name: π·οΈ Label PR by Size |
| 61 | # This job should run after all others, to prevent possible concurrency issues | 80 | # This job should run after all others, to prevent possible concurrency issues |
| 62 | needs: [label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments] | 81 | needs: [app-auth, label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments] |
| 63 | runs-on: ubuntu-latest | 82 | runs-on: ubuntu-latest |
| 64 | # Only needs to run when code is changed | 83 | # Only needs to run when code is changed |
| 65 | if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') | 84 | if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') |
| @@ -76,7 +95,7 @@ jobs: | |||
| 76 | # https://github.com/marketplace/actions/pull-request-size-labeler | 95 | # https://github.com/marketplace/actions/pull-request-size-labeler |
| 77 | uses: codelytv/pr-size-labeler@v1.10.2 | 96 | uses: codelytv/pr-size-labeler@v1.10.2 |
| 78 | with: | 97 | with: |
| 79 | GITHUB_TOKEN: ${{ secrets.ISSUES_BOT_TOKEN }} | 98 | GITHUB_TOKEN: ${{ needs.app-auth.outputs.app_token }} |
| 80 | xs_label: 'π© ⬀ββββ' | 99 | xs_label: 'π© ⬀ββββ' |
| 81 | xs_max_size: '20' | 100 | xs_max_size: '20' |
| 82 | s_label: 'π© ⬀⬀βββ' | 101 | s_label: 'π© ⬀⬀βββ' |
| @@ -93,6 +112,7 @@ jobs: | |||
| 93 | 112 | ||
| 94 | label-by-branches: | 113 | label-by-branches: |
| 95 | name: π·οΈ Label PR by Branches | 114 | name: π·οΈ Label PR by Branches |
| 115 | needs: [app-auth] | ||
| 96 | runs-on: ubuntu-latest | 116 | runs-on: ubuntu-latest |
| 97 | # Only label once when PR is created or when base branch is changed, to allow manual label removal | 117 | # Only label once when PR is created or when base branch is changed, to allow manual label removal |
| 98 | if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base) | 118 | if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base) |
| @@ -109,10 +129,11 @@ jobs: | |||
| 109 | uses: actions/labeler@v5.0.0 | 129 | uses: actions/labeler@v5.0.0 |
| 110 | with: | 130 | with: |
| 111 | configuration-path: .github/pr-auto-labels-by-branch.yml | 131 | configuration-path: .github/pr-auto-labels-by-branch.yml |
| 112 | repo-token: ${{ secrets.ISSUES_BOT_TOKEN }} | 132 | repo-token: ${{ needs.app-auth.outputs.app_token }} |
| 113 | 133 | ||
| 114 | label-by-files: | 134 | label-by-files: |
| 115 | name: π·οΈ Label PR by Files | 135 | name: π·οΈ Label PR by Files |
| 136 | needs: [app-auth] | ||
| 116 | runs-on: ubuntu-latest | 137 | runs-on: ubuntu-latest |
| 117 | # Only needs to run when code is changed | 138 | # Only needs to run when code is changed |
| 118 | if: github.event.action == 'opened' || github.event.action == 'synchronize' | 139 | if: github.event.action == 'opened' || github.event.action == 'synchronize' |
| @@ -129,7 +150,7 @@ jobs: | |||
| 129 | uses: actions/labeler@v5.0.0 | 150 | uses: actions/labeler@v5.0.0 |
| 130 | with: | 151 | with: |
| 131 | configuration-path: .github/pr-auto-labels-by-files.yml | 152 | configuration-path: .github/pr-auto-labels-by-files.yml |
| 132 | repo-token: ${{ secrets.ISSUES_BOT_TOKEN }} | 153 | repo-token: ${{ needs.app-auth.outputs.app_token }} |
| 133 | 154 | ||
| 134 | remove-stale-label: | 155 | remove-stale-label: |
| 135 | name: ποΈ Remove Stale Label on Comment | 156 | name: ποΈ Remove Stale Label on Comment |