Workflows Switch all to use app token/app for any PR/issue labeling/commenting action (#4624) * ci: switch workflows to use app token/app id authentication * That wasn't supposed to go in this PR * chore: refactor to local token minting step [Test] * chore: expose token output from setup-app-token action and add PR checkout step * ci: replace checkout and custom app token with create-github-app-token action in PR merge conflict workflow * ci: add test label action to PR conflict check workflow * another test... * I am losing my sanity * can this work now? please? This action adds my debug level? * it needs to run always * let's do it via curl...? * why did it (totally not me) remove the always() again * Sorry I screamed at you, Qwen. Does this work? * refactor: consolidate GitHub App token creation into individual jobs * chore: remove debug label functionality from merge conflict workflow * chore: let's figure out why labeler is not behaving * chore: remove temporary GitHub API token validation check from PR workflow * ci: ensure workflow jobs run regardless of previous job failures by adding if: always()

806726d737efc190f4997e057707defe94ff3dc2

Wolfsblvt <wolfsblvt@gmail.com>

Signed
7 files changed, +220 -56Ignore whitespace
.github/workflows/issues-auto-manager.yml+54 -9
@@ -15,8 +15,19 @@ jobs:
15 label-on-content:15 label-on-content:
16 name: 🏷️ Label Issues by Content16 name: 🏷️ Label Issues by Content
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: always()
1819
19 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
20 - name: Checkout Repository31 - name: Checkout Repository
21 # Checkout32 # Checkout
22 # https://github.com/marketplace/actions/checkout33 # https://github.com/marketplace/actions/checkout
@@ -32,13 +43,25 @@ jobs:
32 with:43 with:
33 configuration-path: .github/issues-auto-labels.yml44 configuration-path: .github/issues-auto-labels.yml
34 enable-versioned-regex: 045 enable-versioned-regex: 0
35 repo-token: ${{ secrets.ISSUES_BOT_TOKEN }}46 repo-token: ${{ steps.app.outputs.token }}
3647
37 label-on-labels:48 label-on-labels:
38 name: 🏷️ Label Issues by Labels49 name: 🏷️ Label Issues by Labels
50 needs: [label-on-content]
39 runs-on: ubuntu-latest51 runs-on: ubuntu-latest
52 if: always()
4053
41 steps:54 steps:
55 - name: Mint App Token
56 id: app
57 # Create a GitHub App token
58 # https://github.com/marketplace/actions/create-github-app-token
59 uses: actions/create-github-app-token@v2
60 with:
61 app-id: ${{ vars.ST_BOT_APP_ID }}
62 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
63 owner: ${{ github.repository_owner }}
64
42 - name: βœ… Add "πŸ‘ Approved" for relevant labels65 - name: βœ… Add "πŸ‘ Approved" for relevant labels
43 if: contains(fromJSON('["πŸ‘©β€πŸ’» Good First Issue", "πŸ™ Help Wanted", "πŸͺ² Confirmed", "⚠️ High Priority", "❕ Medium Priority", "πŸ’€ Low Priority"]'), github.event.label.name)66 if: contains(fromJSON('["πŸ‘©β€πŸ’» Good First Issue", "πŸ™ Help Wanted", "πŸͺ² Confirmed", "⚠️ High Priority", "❕ Medium Priority", "πŸ’€ Low Priority"]'), github.event.label.name)
44 # πŸ€– Issues Helper67 # πŸ€– Issues Helper
@@ -46,7 +69,7 @@ jobs:
46 uses: actions-cool/issues-helper@v3.6.069 uses: actions-cool/issues-helper@v3.6.0
47 with:70 with:
48 actions: 'add-labels'71 actions: 'add-labels'
49 token: ${{ secrets.ISSUES_BOT_TOKEN }}72 token: ${{ steps.app.outputs.token }}
50 labels: 'πŸ‘ Approved'73 labels: 'πŸ‘ Approved'
5174
52 - name: ❌ Remove progress labels when issue is marked done or stale75 - name: ❌ Remove progress labels when issue is marked done or stale
@@ -56,7 +79,7 @@ jobs:
56 uses: actions-cool/issues-helper@v3.6.079 uses: actions-cool/issues-helper@v3.6.0
57 with:80 with:
58 actions: 'remove-labels'81 actions: 'remove-labels'
59 token: ${{ secrets.ISSUES_BOT_TOKEN }}82 token: ${{ steps.app.outputs.token }}
60 labels: 'πŸ§‘β€πŸ’» In Progress,πŸ€” Unsure,πŸ€” Under Consideration'83 labels: 'πŸ§‘β€πŸ’» In Progress,πŸ€” Unsure,πŸ€” Under Consideration'
6184
62 - name: ❌ Remove temporary labels when confirmed labels are added85 - name: ❌ Remove temporary labels when confirmed labels are added
@@ -66,7 +89,7 @@ jobs:
66 uses: actions-cool/issues-helper@v3.6.089 uses: actions-cool/issues-helper@v3.6.0
67 with:90 with:
68 actions: 'remove-labels'91 actions: 'remove-labels'
69 token: ${{ secrets.ISSUES_BOT_TOKEN }}92 token: ${{ steps.app.outputs.token }}
70 labels: 'πŸ€” Unsure,πŸ€” Under Consideration'93 labels: 'πŸ€” Unsure,πŸ€” Under Consideration'
7194
72 - name: ❌ Remove no bug labels when "πŸͺ² Confirmed" is added95 - name: ❌ Remove no bug labels when "πŸͺ² Confirmed" is added
@@ -76,32 +99,54 @@ jobs:
76 uses: actions-cool/issues-helper@v3.6.099 uses: actions-cool/issues-helper@v3.6.0
77 with:100 with:
78 actions: 'remove-labels'101 actions: 'remove-labels'
79 token: ${{ secrets.ISSUES_BOT_TOKEN }}102 token: ${{ steps.app.outputs.token }}
80 labels: 'βœ–οΈ Not Reproducible,βœ–οΈ Not A Bug'103 labels: 'βœ–οΈ Not Reproducible,βœ–οΈ Not A Bug'
81104
82 remove-stale-label:105 remove-stale-label:
83 name: πŸ—‘οΈ Remove Stale Label on Comment106 name: πŸ—‘οΈ Remove Stale Label on Comment
107 needs: [label-on-content, label-on-labels]
84 runs-on: ubuntu-latest108 runs-on: ubuntu-latest
85 # Only run this on new comments, to automatically remove the stale label109 # Only run this on new comments, to automatically remove the stale label
86 if: github.event_name == 'issue_comment' && github.actor != 'github-actions[bot]'110 if: always() && (github.event_name == 'issue_comment' && github.actor != 'github-actions[bot]')
87111
88 steps:112 steps:
113 - name: Mint App Token
114 id: app
115 # Create a GitHub App token
116 # https://github.com/marketplace/actions/create-github-app-token
117 uses: actions/create-github-app-token@v2
118 with:
119 app-id: ${{ vars.ST_BOT_APP_ID }}
120 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
121 owner: ${{ github.repository_owner }}
122
89 - name: Remove Stale Label123 - name: Remove Stale Label
90 # πŸ€– Issues Helper124 # πŸ€– Issues Helper
91 # https://github.com/marketplace/actions/issues-helper125 # https://github.com/marketplace/actions/issues-helper
92 uses: actions-cool/issues-helper@v3.6.0126 uses: actions-cool/issues-helper@v3.6.0
93 with:127 with:
94 actions: 'remove-labels'128 actions: 'remove-labels'
95 token: ${{ secrets.ISSUES_BOT_TOKEN }}129 token: ${{ steps.app.outputs.token }}
96 issue-number: ${{ github.event.issue.number }}130 issue-number: ${{ github.event.issue.number }}
97 labels: '⚰️ Stale,πŸ•ΈοΈ Inactive,🚏 Awaiting User Response,πŸ›‘ No Response'131 labels: '⚰️ Stale,πŸ•ΈοΈ Inactive,🚏 Awaiting User Response,πŸ›‘ No Response'
98132
99 write-auto-comments:133 write-auto-comments:
100 name: πŸ’¬ Post Issue Comments Based on Labels134 name: πŸ’¬ Post Issue Comments Based on Labels
101 needs: [label-on-content, label-on-labels]135 needs: [label-on-content, label-on-labels, remove-stale-label]
102 runs-on: ubuntu-latest136 runs-on: ubuntu-latest
137 if: always()
103138
104 steps:139 steps:
140 - name: Mint App Token
141 id: app
142 # Create a GitHub App token
143 # https://github.com/marketplace/actions/create-github-app-token
144 uses: actions/create-github-app-token@v2
145 with:
146 app-id: ${{ vars.ST_BOT_APP_ID }}
147 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
148 owner: ${{ github.repository_owner }}
149
105 - name: Checkout Repository150 - name: Checkout Repository
106 # Checkout151 # Checkout
107 # https://github.com/marketplace/actions/checkout152 # https://github.com/marketplace/actions/checkout
@@ -113,4 +158,4 @@ jobs:
113 uses: peaceiris/actions-label-commenter@v1.10.0158 uses: peaceiris/actions-label-commenter@v1.10.0
114 with:159 with:
115 config_file: .github/issues-auto-comments.yml160 config_file: .github/issues-auto-comments.yml
116 github_token: ${{ secrets.ISSUES_BOT_TOKEN }}161 github_token: ${{ steps.app.outputs.token }}
.github/workflows/issues-updates-on-merge.yml+12 -1
@@ -15,8 +15,19 @@ jobs:
15 update-linked-issues:15 update-linked-issues:
16 name: πŸ”— Mark Linked Issues Done on Push16 name: πŸ”— Mark Linked Issues Done on Push
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: always()
1819
19 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
20 - name: Checkout Repository31 - name: Checkout Repository
21 # Checkout32 # Checkout
22 # https://github.com/marketplace/actions/checkout33 # https://github.com/marketplace/actions/checkout
@@ -31,7 +42,7 @@ jobs:
31 - name: Label Linked Issues42 - name: Label Linked Issues
32 id: label_linked_issues43 id: label_linked_issues
33 env:44 env:
34 GH_TOKEN: ${{ secrets.ISSUES_BOT_TOKEN }}45 GH_TOKEN: ${{ steps.app.outputs.token }}
35 run: |46 run: |
36 for ISSUE in $(echo $issues | jq -r '.[]'); do47 for ISSUE in $(echo $issues | jq -r '.[]'); do
37 if [ "${{ github.ref }}" == "refs/heads/staging" ]; then48 if [ "${{ github.ref }}" == "refs/heads/staging" ]; then
.github/workflows/job-close-stale.yml+38 -5
@@ -15,14 +15,25 @@ jobs:
15 mark-inactivity:15 mark-inactivity:
16 name: ⏳ Mark Issues/PRs without Activity16 name: ⏳ Mark Issues/PRs without Activity
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: always()
1819
19 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
20 - name: Mark Issues/PRs without Activity31 - name: Mark Issues/PRs without Activity
21 # Close Stale Issues and PRs32 # Close Stale Issues and PRs
22 # https://github.com/marketplace/actions/close-stale-issues33 # https://github.com/marketplace/actions/close-stale-issues
23 uses: actions/stale@v9.1.034 uses: actions/stale@v9.1.0
24 with:35 with:
25 repo-token: ${{ secrets.ISSUES_BOT_TOKEN }}36 repo-token: ${{ steps.app.outputs.token }}
26 days-before-stale: 18337 days-before-stale: 183
27 days-before-close: 738 days-before-close: 7
28 operations-per-run: 3039 operations-per-run: 30
@@ -47,16 +58,27 @@ jobs:
4758
48 await-user-response:59 await-user-response:
49 name: ⚠️ Mark Issues/PRs Awaiting User Response60 name: ⚠️ Mark Issues/PRs Awaiting User Response
61 needs: [mark-inactivity]
50 runs-on: ubuntu-latest62 runs-on: ubuntu-latest
51 needs: mark-inactivity63 if: always()
5264
53 steps:65 steps:
66 - name: Mint App Token
67 id: app
68 # Create a GitHub App token
69 # https://github.com/marketplace/actions/create-github-app-token
70 uses: actions/create-github-app-token@v2
71 with:
72 app-id: ${{ vars.ST_BOT_APP_ID }}
73 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
74 owner: ${{ github.repository_owner }}
75
54 - name: Mark Issues/PRs Awaiting User Response76 - name: Mark Issues/PRs Awaiting User Response
55 # Close Stale Issues and PRs77 # Close Stale Issues and PRs
56 # https://github.com/marketplace/actions/close-stale-issues78 # https://github.com/marketplace/actions/close-stale-issues
57 uses: actions/stale@v9.1.079 uses: actions/stale@v9.1.0
58 with:80 with:
59 repo-token: ${{ secrets.ISSUES_BOT_TOKEN }}81 repo-token: ${{ steps.app.outputs.token }}
60 days-before-stale: 782 days-before-stale: 7
61 days-before-close: 783 days-before-close: 7
62 operations-per-run: 3084 operations-per-run: 30
@@ -74,16 +96,27 @@ jobs:
7496
75 alternative-exists:97 alternative-exists:
76 name: πŸ”„ Mark Issues with Alternative Exists98 name: πŸ”„ Mark Issues with Alternative Exists
99 needs: [mark-inactivity, await-user-response]
77 runs-on: ubuntu-latest100 runs-on: ubuntu-latest
78 needs: await-user-response101 if: always()
79102
80 steps:103 steps:
104 - name: Mint App Token
105 id: app
106 # Create a GitHub App token
107 # https://github.com/marketplace/actions/create-github-app-token
108 uses: actions/create-github-app-token@v2
109 with:
110 app-id: ${{ vars.ST_BOT_APP_ID }}
111 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
112 owner: ${{ github.repository_owner }}
113
81 - name: Mark Issues with Alternative Exists114 - name: Mark Issues with Alternative Exists
82 # Close Stale Issues and PRs115 # Close Stale Issues and PRs
83 # https://github.com/marketplace/actions/close-stale-issues116 # https://github.com/marketplace/actions/close-stale-issues
84 uses: actions/stale@v9.1.0117 uses: actions/stale@v9.1.0
85 with:118 with:
86 repo-token: ${{ secrets.ISSUES_BOT_TOKEN }}119 repo-token: ${{ steps.app.outputs.token }}
87 days-before-stale: 7120 days-before-stale: 7
88 days-before-close: 7121 days-before-close: 7
89 operations-per-run: 30122 operations-per-run: 30
.github/workflows/on-close-handler.yml+12 -1
@@ -15,14 +15,25 @@ jobs:
15 remove-labels:15 remove-labels:
16 name: πŸ—‘οΈ Remove Pending Labels on Close16 name: πŸ—‘οΈ Remove Pending Labels on Close
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: always()
1819
19 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
20 - name: Remove Pending Labels on Close31 - name: Remove Pending Labels on Close
21 # πŸ€– Issues Helper32 # πŸ€– Issues Helper
22 # https://github.com/marketplace/actions/issues-helper33 # https://github.com/marketplace/actions/issues-helper
23 uses: actions-cool/issues-helper@v3.6.034 uses: actions-cool/issues-helper@v3.6.0
24 with:35 with:
25 actions: remove-labels36 actions: remove-labels
26 token: ${{ secrets.ISSUES_BOT_TOKEN }}37 token: ${{ steps.app.outputs.token }}
27 issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}38 issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
28 labels: '🚏 Awaiting User Response,πŸ§‘β€πŸ’» In Progress,πŸ“Œ Keep Open,🚫 Merge Conflicts,πŸ”¬ Needs Testing,πŸ”¨ Needs Work,⚰️ Stale,β›” Waiting For External/Upstream'39 labels: '🚏 Awaiting User Response,πŸ§‘β€πŸ’» In Progress,πŸ“Œ Keep Open,🚫 Merge Conflicts,πŸ”¬ Needs Testing,πŸ”¨ Needs Work,⚰️ Stale,β›” Waiting For External/Upstream'
.github/workflows/on-open-handler.yml+12 -2
@@ -15,15 +15,25 @@ jobs:
15 label-maintainer:15 label-maintainer:
16 name: 🏷️ Label if Author is a Repo Maintainer16 name: 🏷️ Label if Author is a Repo Maintainer
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor)18 if: always() && contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor)
1919
20 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
21 - name: Label if Author is a Repo Maintainer31 - name: Label if Author is a Repo Maintainer
22 # πŸ€– Issues Helper32 # πŸ€– Issues Helper
23 # https://github.com/marketplace/actions/issues-helper33 # https://github.com/marketplace/actions/issues-helper
24 uses: actions-cool/issues-helper@v3.6.034 uses: actions-cool/issues-helper@v3.6.0
25 with:35 with:
26 actions: 'add-labels'36 actions: 'add-labels'
27 token: ${{ secrets.ISSUES_BOT_TOKEN }}37 token: ${{ steps.app.outputs.token }}
28 issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}38 issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
29 labels: 'πŸ‘· Maintainer'39 labels: 'πŸ‘· Maintainer'
.github/workflows/pr-auto-manager.yml+80 -37
@@ -12,30 +12,11 @@ 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_PRIVATE_KEY }}
32 owner: ${{ github.repository_owner }}
33
34 run-eslint:15 run-eslint:
35 name: βœ… Check ESLint on PR16 name: βœ… Check ESLint on PR
36 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
37 # Only needs to run when code is changed18 # Only needs to run when code is changed
38 if: github.event.action == 'opened' || github.event.action == 'synchronize'19 if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize')
3920
40 # Override permissions, linter likely needs write access to issues21 # Override permissions, linter likely needs write access to issues
41 permissions:22 permissions:
@@ -67,7 +48,7 @@ jobs:
67 # https://github.com/marketplace/actions/action-eslint48 # https://github.com/marketplace/actions/action-eslint
68 uses: sibiraj-s/action-eslint@v3.0.149 uses: sibiraj-s/action-eslint@v3.0.1
69 with:50 with:
70 token: ${{ secrets.GITHUB_TOKEN }}51 token: ${{ secrets.GITHUB_TOKEN }} # ESLint can run with the original permissions
71 eslint-args: '--ignore-path=.gitignore --quiet'52 eslint-args: '--ignore-path=.gitignore --quiet'
72 extensions: 'js'53 extensions: 'js'
73 annotations: true54 annotations: true
@@ -78,7 +59,7 @@ jobs:
78 label-by-size:59 label-by-size:
79 name: 🏷️ Label PR by Size60 name: 🏷️ Label PR by Size
80 # This job should run after all others, to prevent possible concurrency issues61 # This job should run after all others, to prevent possible concurrency issues
81 needs: [app-auth, label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments]62 needs: [label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels, write-auto-comments]
82 runs-on: ubuntu-latest63 runs-on: ubuntu-latest
83 # Only needs to run when code is changed64 # Only needs to run when code is changed
84 if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize')65 if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize')
@@ -90,12 +71,22 @@ jobs:
90 pull-requests: write71 pull-requests: write
9172
92 steps:73 steps:
74 - name: Mint App Token
75 id: app
76 # Create a GitHub App token
77 # https://github.com/marketplace/actions/create-github-app-token
78 uses: actions/create-github-app-token@v2
79 with:
80 app-id: ${{ vars.ST_BOT_APP_ID }}
81 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
82 owner: ${{ github.repository_owner }}
83
93 - name: Label PR Size84 - name: Label PR Size
94 # Pull Request Size Labeler85 # Pull Request Size Labeler
95 # https://github.com/marketplace/actions/pull-request-size-labeler86 # https://github.com/marketplace/actions/pull-request-size-labeler
96 uses: codelytv/pr-size-labeler@v1.10.287 uses: codelytv/pr-size-labeler@v1.10.2
97 with:88 with:
98 GITHUB_TOKEN: ${{ needs.app-auth.outputs.app_token }}89 GITHUB_TOKEN: ${{ steps.app.outputs.token }}
99 xs_label: '🟩 ⬀○○○○'90 xs_label: '🟩 ⬀○○○○'
100 xs_max_size: '20'91 xs_max_size: '20'
101 s_label: '🟩 ⬀⬀○○○'92 s_label: '🟩 ⬀⬀○○○'
@@ -112,12 +103,21 @@ jobs:
112103
113 label-by-branches:104 label-by-branches:
114 name: 🏷️ Label PR by Branches105 name: 🏷️ Label PR by Branches
115 needs: [app-auth]
116 runs-on: ubuntu-latest106 runs-on: ubuntu-latest
117 # Only label once when PR is created or when base branch is changed, to allow manual label removal107 # Only label once when PR is created or when base branch is changed, to allow manual label removal
118 if: github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base)108 if: always() && (github.event.action == 'opened' || (github.event.action == 'synchronize' && github.event.changes.base))
119109
120 steps:110 steps:
111 - name: Mint App Token
112 id: app
113 # Create a GitHub App token
114 # https://github.com/marketplace/actions/create-github-app-token
115 uses: actions/create-github-app-token@v2
116 with:
117 app-id: ${{ vars.ST_BOT_APP_ID }}
118 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
119 owner: ${{ github.repository_owner }}
120
121 - name: Checkout Repository121 - name: Checkout Repository
122 # Checkout122 # Checkout
123 # https://github.com/marketplace/actions/checkout123 # https://github.com/marketplace/actions/checkout
@@ -129,16 +129,26 @@ jobs:
129 uses: actions/labeler@v5.0.0129 uses: actions/labeler@v5.0.0
130 with:130 with:
131 configuration-path: .github/pr-auto-labels-by-branch.yml131 configuration-path: .github/pr-auto-labels-by-branch.yml
132 repo-token: ${{ needs.app-auth.outputs.app_token }}132 repo-token: ${{ steps.app.outputs.token }}
133133
134 label-by-files:134 label-by-files:
135 name: 🏷️ Label PR by Files135 name: 🏷️ Label PR by Files
136 needs: [app-auth]136 needs: [label-by-branches]
137 runs-on: ubuntu-latest137 runs-on: ubuntu-latest
138 # Only needs to run when code is changed138 # Only needs to run when code is changed
139 if: github.event.action == 'opened' || github.event.action == 'synchronize'139 if: always() && (github.event.action == 'opened' || github.event.action == 'synchronize')
140140
141 steps:141 steps:
142 - name: Mint App Token
143 id: app
144 # Create a GitHub App token
145 # https://github.com/marketplace/actions/create-github-app-token
146 uses: actions/create-github-app-token@v2
147 with:
148 app-id: ${{ vars.ST_BOT_APP_ID }}
149 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
150 owner: ${{ github.repository_owner }}
151
142 - name: Checkout Repository152 - name: Checkout Repository
143 # Checkout153 # Checkout
144 # https://github.com/marketplace/actions/checkout154 # https://github.com/marketplace/actions/checkout
@@ -148,15 +158,18 @@ jobs:
148 # Pull Request Labeler158 # Pull Request Labeler
149 # https://github.com/marketplace/actions/labeler159 # https://github.com/marketplace/actions/labeler
150 uses: actions/labeler@v5.0.0160 uses: actions/labeler@v5.0.0
161 env:
162 GITHUB_TOKEN: ${{ steps.app.outputs.token }} # labeler action needs some handholding
151 with:163 with:
152 configuration-path: .github/pr-auto-labels-by-files.yml164 configuration-path: .github/pr-auto-labels-by-files.yml
153 repo-token: ${{ needs.app-auth.outputs.app_token }}165 repo-token: ${{ steps.app.outputs.token }}
154166
155 remove-stale-label:167 remove-stale-label:
156 name: πŸ—‘οΈ Remove Stale Label on Comment168 name: πŸ—‘οΈ Remove Stale Label on Comment
169 needs: [label-by-branches, label-by-files]
157 runs-on: ubuntu-latest170 runs-on: ubuntu-latest
158 # Only runs on comments not done by the github actions bot171 # Only runs on comments not done by the github actions bot
159 if: github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]'172 if: always() && (github.event_name == 'pull_request_review_comment' && github.actor != 'github-actions[bot]')
160173
161 # Override permissions, issue labeler needs issues write access174 # Override permissions, issue labeler needs issues write access
162 permissions:175 permissions:
@@ -165,19 +178,29 @@ jobs:
165 pull-requests: write178 pull-requests: write
166179
167 steps:180 steps:
181 - name: Mint App Token
182 id: app
183 # Create a GitHub App token
184 # https://github.com/marketplace/actions/create-github-app-token
185 uses: actions/create-github-app-token@v2
186 with:
187 app-id: ${{ vars.ST_BOT_APP_ID }}
188 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
189 owner: ${{ github.repository_owner }}
190
168 - name: Remove Stale Label191 - name: Remove Stale Label
169 # πŸ€– Issues Helper192 # πŸ€– Issues Helper
170 # https://github.com/marketplace/actions/issues-helper193 # https://github.com/marketplace/actions/issues-helper
171 uses: actions-cool/issues-helper@v3.6.0194 uses: actions-cool/issues-helper@v3.6.0
172 with:195 with:
173 actions: 'remove-labels'196 actions: 'remove-labels'
174 token: ${{ secrets.ISSUES_BOT_TOKEN }}197 token: ${{ steps.app.outputs.token }}
175 issue-number: ${{ github.event.pull_request.number }}198 issue-number: ${{ github.event.pull_request.number }}
176 labels: '⚰️ Stale'199 labels: '⚰️ Stale'
177200
178 check-merge-blocking-labels:201 check-merge-blocking-labels:
179 name: 🚫 Check Merge Blocking Labels202 name: 🚫 Check Merge Blocking Labels
180 needs: [label-by-branches, label-by-files]203 needs: [label-by-branches, label-by-files, remove-stale-label]
181 runs-on: ubuntu-latest204 runs-on: ubuntu-latest
182 # Run, even if the previous jobs were skipped/failed205 # Run, even if the previous jobs were skipped/failed
183 if: always()206 if: always()
@@ -227,12 +250,22 @@ jobs:
227250
228 write-auto-comments:251 write-auto-comments:
229 name: πŸ’¬ Post PR Comments Based on Labels252 name: πŸ’¬ Post PR Comments Based on Labels
230 needs: [label-by-branches, label-by-files]253 needs: [label-by-branches, label-by-files, remove-stale-label, check-merge-blocking-labels]
231 runs-on: ubuntu-latest254 runs-on: ubuntu-latest
232 # Run, even if the previous jobs were skipped/failed255 # Run, even if the previous jobs were skipped/failed
233 if: always()256 if: always()
234257
235 steps:258 steps:
259 - name: Mint App Token
260 id: app
261 # Create a GitHub App token
262 # https://github.com/marketplace/actions/create-github-app-token
263 uses: actions/create-github-app-token@v2
264 with:
265 app-id: ${{ vars.ST_BOT_APP_ID }}
266 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
267 owner: ${{ github.repository_owner }}
268
236 - name: Checkout Repository269 - name: Checkout Repository
237 # Checkout270 # Checkout
238 # https://github.com/marketplace/actions/checkout271 # https://github.com/marketplace/actions/checkout
@@ -244,13 +277,13 @@ jobs:
244 uses: peaceiris/actions-label-commenter@v1.10.0277 uses: peaceiris/actions-label-commenter@v1.10.0
245 with:278 with:
246 config_file: .github/pr-auto-comments.yml279 config_file: .github/pr-auto-comments.yml
247 github_token: ${{ secrets.GITHUB_TOKEN }}280 github_token: ${{ steps.app.outputs.token }}
248281
249 # This runs on merged PRs to staging, reading the PR body and directly linked issues. Check `issues-updates-on-merge.yml`:`update-linked-issues` for commit-based updates.282 # This runs on merged PRs to staging, reading the PR body and directly linked issues. Check `issues-updates-on-merge.yml`:`update-linked-issues` for commit-based updates.
250 update-linked-issues:283 update-linked-issues:
251 name: πŸ”— Mark Linked Issues Done on Staging Merge284 name: πŸ”— Mark Linked Issues Done on Staging Merge
252 runs-on: ubuntu-latest285 runs-on: ubuntu-latest
253 if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging'286 if: always() && (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging')
254287
255 # Override permissions, We need to be able to write to issues288 # Override permissions, We need to be able to write to issues
256 permissions:289 permissions:
@@ -259,6 +292,16 @@ jobs:
259 pull-requests: write292 pull-requests: write
260293
261 steps:294 steps:
295 - name: Mint App Token
296 id: app
297 # Create a GitHub App token
298 # https://github.com/marketplace/actions/create-github-app-token
299 uses: actions/create-github-app-token@v2
300 with:
301 app-id: ${{ vars.ST_BOT_APP_ID }}
302 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
303 owner: ${{ github.repository_owner }}
304
262 - name: Extract Linked Issues From PR Description305 - name: Extract Linked Issues From PR Description
263 id: extract_issues306 id: extract_issues
264 run: |307 run: |
@@ -271,7 +314,7 @@ jobs:
271 PR_NUMBER=${{ github.event.pull_request.number }}314 PR_NUMBER=${{ github.event.pull_request.number }}
272 REPO=${{ github.repository }}315 REPO=${{ github.repository }}
273 API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues"316 API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues"
274 ISSUES=$(curl -s -H "Authorization: token ${{ secrets.ISSUES_BOT_TOKEN }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]')317 ISSUES=$(curl -s -H "Authorization: token ${{ steps.app.outputs.token }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]')
275 echo "linked_issues=$ISSUES" >> $GITHUB_ENV318 echo "linked_issues=$ISSUES" >> $GITHUB_ENV
276319
277 - name: Merge Issue Lists320 - name: Merge Issue Lists
@@ -283,7 +326,7 @@ jobs:
283 - name: Label Linked Issues326 - name: Label Linked Issues
284 id: label_linked_issues327 id: label_linked_issues
285 env:328 env:
286 GH_TOKEN: ${{ secrets.ISSUES_BOT_TOKEN }}329 GH_TOKEN: ${{ steps.app.outputs.token }}
287 run: |330 run: |
288 for ISSUE in $(echo $final_issues | jq -r '.[]'); do331 for ISSUE in $(echo $final_issues | jq -r '.[]'); do
289 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" --remove-label "πŸ§‘β€πŸ’» In Progress"332 gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" --remove-label "πŸ§‘β€πŸ’» In Progress"
.github/workflows/pr-check-merge-conflicts.yaml+12 -1
@@ -15,14 +15,25 @@ jobs:
15 check-merge-conflicts:15 check-merge-conflicts:
16 name: βš”οΈ Check Merge Conflicts16 name: βš”οΈ Check Merge Conflicts
17 runs-on: ubuntu-latest17 runs-on: ubuntu-latest
18 if: always()
1819
19 steps:20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
20 - name: Check Merge Conflicts31 - name: Check Merge Conflicts
21 # Label Conflicting Pull Requests32 # Label Conflicting Pull Requests
22 # https://github.com/marketplace/actions/label-conflicting-pull-requests33 # https://github.com/marketplace/actions/label-conflicting-pull-requests
23 uses: eps1lon/actions-label-merge-conflict@v3.0.334 uses: eps1lon/actions-label-merge-conflict@v3.0.3
24 with:35 with:
25 dirtyLabel: '🚫 Merge Conflicts'36 dirtyLabel: '🚫 Merge Conflicts'
26 repoToken: ${{ secrets.ISSUES_BOT_TOKEN }}37 repoToken: ${{ steps.app.outputs.token }}
27 commentOnDirty: >38 commentOnDirty: >
28 ⚠️ This PR has conflicts that need to be resolved before it can be merged.39 ⚠️ This PR has conflicts that need to be resolved before it can be merged.