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 -4Ignore whitespace
.github/pr-auto-comments.yml+10 -0
@@ -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!
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
44 - name: πŸŸ₯ ⬀⬀⬀⬀⬀54 - name: πŸŸ₯ ⬀⬀⬀⬀⬀
45 labeled:55 labeled:
46 pr:56 pr:
.github/workflows/pr-auto-manager.yml+25 -4
@@ -12,6 +12,25 @@ permissions:
12 pull-requests: write12 pull-requests: write
1313
14jobs:14jobs:
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 PR35 name: βœ… Check ESLint on PR
17 runs-on: ubuntu-latest36 runs-on: ubuntu-latest
@@ -59,7 +78,7 @@ jobs:
59 label-by-size:78 label-by-size:
60 name: 🏷️ Label PR by Size79 name: 🏷️ Label PR by Size
61 # This job should run after all others, to prevent possible concurrency issues80 # 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-latest82 runs-on: ubuntu-latest
64 # Only needs to run when code is changed83 # 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-labeler95 # https://github.com/marketplace/actions/pull-request-size-labeler
77 uses: codelytv/pr-size-labeler@v1.10.296 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:
93112
94 label-by-branches:113 label-by-branches:
95 name: 🏷️ Label PR by Branches114 name: 🏷️ Label PR by Branches
115 needs: [app-auth]
96 runs-on: ubuntu-latest116 runs-on: ubuntu-latest
97 # Only label once when PR is created or when base branch is changed, to allow manual label removal117 # 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.0129 uses: actions/labeler@v5.0.0
110 with:130 with:
111 configuration-path: .github/pr-auto-labels-by-branch.yml131 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 }}
113133
114 label-by-files:134 label-by-files:
115 name: 🏷️ Label PR by Files135 name: 🏷️ Label PR by Files
136 needs: [app-auth]
116 runs-on: ubuntu-latest137 runs-on: ubuntu-latest
117 # Only needs to run when code is changed138 # 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.0150 uses: actions/labeler@v5.0.0
130 with:151 with:
131 configuration-path: .github/pr-auto-labels-by-files.yml152 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 }}
133154
134 remove-stale-label:155 remove-stale-label:
135 name: πŸ—‘οΈ Remove Stale Label on Comment156 name: πŸ—‘οΈ Remove Stale Label on Comment