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 | 41 | 🔬 This PR needs testing! |
| 42 | 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 | 54 | - name: 🟥 ⬤⬤⬤⬤⬤ |
| 45 | 55 | labeled: |
| 46 | 56 | pr: |
| @@ -12,6 +12,25 @@ permissions: | ||
| 12 | 12 | pull-requests: write |
| 13 | 13 | |
| 14 | 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 | 34 | run-eslint: |
| 16 | 35 | name: ✅ Check ESLint on PR |
| 17 | 36 | runs-on: ubuntu-latest |
| @@ -59,7 +78,7 @@ jobs: | ||
| 59 | 78 | label-by-size: |
| 60 | 79 | name: 🏷️ Label PR by Size |
| 61 | 80 | # This job should run after all others, to prevent possible concurrency issues |
| 62 | 81 | needs: [app-auth, label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments] |
| 63 | 82 | runs-on: ubuntu-latest |
| 64 | 83 | # Only needs to run when code is changed |
| 65 | 84 | if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize') |
| @@ -76,7 +95,7 @@ jobs: | ||
| 76 | 95 | # https://github.com/marketplace/actions/pull-request-size-labeler |
| 77 | 96 | uses: codelytv/pr-size-labeler@v1.10.2 |
| 78 | 97 | with: |
| 79 | 98 | GITHUB_TOKEN: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }} |
| 80 | 99 | xs_label: '🟩 ⬤○○○○' |
| 81 | 100 | xs_max_size: '20' |
| 82 | 101 | s_label: '🟩 ⬤⬤○○○' |
| @@ -93,6 +112,7 @@ jobs: | ||
| 93 | 112 | |
| 94 | 113 | label-by-branches: |
| 95 | 114 | name: 🏷️ Label PR by Branches |
| 115 | + needs: [app-auth] | |
| 96 | 116 | runs-on: ubuntu-latest |
| 97 | 117 | # Only label once when PR is created or when base branch is changed, to allow manual label removal |
| 98 | 118 | if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base) |
| @@ -109,10 +129,11 @@ jobs: | ||
| 109 | 129 | uses: actions/labeler@v5.0.0 |
| 110 | 130 | with: |
| 111 | 131 | configuration-path: .github/pr-auto-labels-by-branch.yml |
| 112 | 132 | repo-token: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }} |
| 113 | 133 | |
| 114 | 134 | label-by-files: |
| 115 | 135 | name: 🏷️ Label PR by Files |
| 136 | + needs: [app-auth] | |
| 116 | 137 | runs-on: ubuntu-latest |
| 117 | 138 | # Only needs to run when code is changed |
| 118 | 139 | if: github.event.action == 'opened' || github.event.action == 'synchronize' |
| @@ -129,7 +150,7 @@ jobs: | ||
| 129 | 150 | uses: actions/labeler@v5.0.0 |
| 130 | 151 | with: |
| 131 | 152 | configuration-path: .github/pr-auto-labels-by-files.yml |
| 132 | 153 | repo-token: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }} |
| 133 | 154 | |
| 134 | 155 | remove-stale-label: |
| 135 | 156 | name: 🗑️ Remove Stale Label on Comment |