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>

f88ba369dd14f0abad24290a9d1542b373d29606

Wolfsblvt <wolfsblvt@gmail.com>

Signed
2 files changed, +35 -4Showing whitespace changes
.github/pr-auto-comments.yml+10 -0
@@ -41,6 +41,16 @@ labels:
4141 🔬 This PR needs testing!
4242 Any contributor can test and leave reviews, so feel free to help us out!
4343
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+
4454 - name: 🟥 ⬤⬤⬤⬤⬤
4555 labeled:
4656 pr:
.github/workflows/pr-auto-manager.yml+25 -4
@@ -12,6 +12,25 @@ permissions:
1212 pull-requests: write
1313
1414jobs:
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+
1534 run-eslint:
1635 name: ✅ Check ESLint on PR
1736 runs-on: ubuntu-latest
@@ -59,7 +78,7 @@ jobs:
5978 label-by-size:
6079 name: 🏷️ Label PR by Size
6180 # This job should run after all others, to prevent possible concurrency issues
6281 needs: [app-auth, label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments]
6382 runs-on: ubuntu-latest
6483 # Only needs to run when code is changed
6584 if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize')
@@ -76,7 +95,7 @@ jobs:
7695 # https://github.com/marketplace/actions/pull-request-size-labeler
7796 uses: codelytv/pr-size-labeler@v1.10.2
7897 with:
7998 GITHUB_TOKEN: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }}
8099 xs_label: '🟩 ⬤○○○○'
81100 xs_max_size: '20'
82101 s_label: '🟩 ⬤⬤○○○'
@@ -93,6 +112,7 @@ jobs:
93112
94113 label-by-branches:
95114 name: 🏷️ Label PR by Branches
115+ needs: [app-auth]
96116 runs-on: ubuntu-latest
97117 # Only label once when PR is created or when base branch is changed, to allow manual label removal
98118 if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base)
@@ -109,10 +129,11 @@ jobs:
109129 uses: actions/labeler@v5.0.0
110130 with:
111131 configuration-path: .github/pr-auto-labels-by-branch.yml
112132 repo-token: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }}
113133
114134 label-by-files:
115135 name: 🏷️ Label PR by Files
136+ needs: [app-auth]
116137 runs-on: ubuntu-latest
117138 # Only needs to run when code is changed
118139 if: github.event.action == 'opened' || github.event.action == 'synchronize'
@@ -129,7 +150,7 @@ jobs:
129150 uses: actions/labeler@v5.0.0
130151 with:
131152 configuration-path: .github/pr-auto-labels-by-files.yml
132153 repo-token: ${{ secretsneeds.ISSUES_BOT_TOKENapp-auth.outputs.app_token }}
133154
134155 remove-stale-label:
135156 name: 🗑️ Remove Stale Label on Comment