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()
Signed| @@ -15,8 +15,19 @@ jobs: | |||
| 15 | label-on-content: | 15 | label-on-content: |
| 16 | name: π·οΈ Label Issues by Content | 16 | name: π·οΈ Label Issues by Content |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: always() | ||
| 18 | 19 | ||
| 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 Repository | 31 | - name: Checkout Repository |
| 21 | # Checkout | 32 | # Checkout |
| 22 | # https://github.com/marketplace/actions/checkout | 33 | # https://github.com/marketplace/actions/checkout |
| @@ -32,13 +43,25 @@ jobs: | |||
| 32 | with: | 43 | with: |
| 33 | configuration-path: .github/issues-auto-labels.yml | 44 | configuration-path: .github/issues-auto-labels.yml |
| 34 | enable-versioned-regex: 0 | 45 | enable-versioned-regex: 0 |
| 35 | repo-token: ${{ secrets.ISSUES_BOT_TOKEN }} | 46 | repo-token: ${{ steps.app.outputs.token }} |
| 36 | 47 | ||
| 37 | label-on-labels: | 48 | label-on-labels: |
| 38 | name: π·οΈ Label Issues by Labels | 49 | name: π·οΈ Label Issues by Labels |
| 50 | needs: [label-on-content] | ||
| 39 | runs-on: ubuntu-latest | 51 | runs-on: ubuntu-latest |
| 52 | if: always() | ||
| 40 | 53 | ||
| 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 labels | 65 | - 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 Helper | 67 | # π€ Issues Helper |
| @@ -46,7 +69,7 @@ jobs: | |||
| 46 | uses: actions-cool/issues-helper@v3.6.0 | 69 | 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' |
| 51 | 74 | ||
| 52 | - name: β Remove progress labels when issue is marked done or stale | 75 | - name: β Remove progress labels when issue is marked done or stale |
| @@ -56,7 +79,7 @@ jobs: | |||
| 56 | uses: actions-cool/issues-helper@v3.6.0 | 79 | 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' |
| 61 | 84 | ||
| 62 | - name: β Remove temporary labels when confirmed labels are added | 85 | - name: β Remove temporary labels when confirmed labels are added |
| @@ -66,7 +89,7 @@ jobs: | |||
| 66 | uses: actions-cool/issues-helper@v3.6.0 | 89 | 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' |
| 71 | 94 | ||
| 72 | - name: β Remove no bug labels when "πͺ² Confirmed" is added | 95 | - name: β Remove no bug labels when "πͺ² Confirmed" is added |
| @@ -76,32 +99,54 @@ jobs: | |||
| 76 | uses: actions-cool/issues-helper@v3.6.0 | 99 | 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' |
| 81 | 104 | ||
| 82 | remove-stale-label: | 105 | remove-stale-label: |
| 83 | name: ποΈ Remove Stale Label on Comment | 106 | name: ποΈ Remove Stale Label on Comment |
| 107 | needs: [label-on-content, label-on-labels] | ||
| 84 | runs-on: ubuntu-latest | 108 | runs-on: ubuntu-latest |
| 85 | # Only run this on new comments, to automatically remove the stale label | 109 | # 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]') |
| 87 | 111 | ||
| 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 Label | 123 | - name: Remove Stale Label |
| 90 | # π€ Issues Helper | 124 | # π€ Issues Helper |
| 91 | # https://github.com/marketplace/actions/issues-helper | 125 | # https://github.com/marketplace/actions/issues-helper |
| 92 | uses: actions-cool/issues-helper@v3.6.0 | 126 | 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' |
| 98 | 132 | ||
| 99 | write-auto-comments: | 133 | write-auto-comments: |
| 100 | name: π¬ Post Issue Comments Based on Labels | 134 | 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-latest | 136 | runs-on: ubuntu-latest |
| 137 | if: always() | ||
| 103 | 138 | ||
| 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 Repository | 150 | - name: Checkout Repository |
| 106 | # Checkout | 151 | # Checkout |
| 107 | # https://github.com/marketplace/actions/checkout | 152 | # https://github.com/marketplace/actions/checkout |
| @@ -113,4 +158,4 @@ jobs: | |||
| 113 | uses: peaceiris/actions-label-commenter@v1.10.0 | 158 | uses: peaceiris/actions-label-commenter@v1.10.0 |
| 114 | with: | 159 | with: |
| 115 | config_file: .github/issues-auto-comments.yml | 160 | config_file: .github/issues-auto-comments.yml |
| 116 | github_token: ${{ secrets.ISSUES_BOT_TOKEN }} | 161 | github_token: ${{ steps.app.outputs.token }} |
| @@ -15,8 +15,19 @@ jobs: | |||
| 15 | update-linked-issues: | 15 | update-linked-issues: |
| 16 | name: π Mark Linked Issues Done on Push | 16 | name: π Mark Linked Issues Done on Push |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: always() | ||
| 18 | 19 | ||
| 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 Repository | 31 | - name: Checkout Repository |
| 21 | # Checkout | 32 | # Checkout |
| 22 | # https://github.com/marketplace/actions/checkout | 33 | # https://github.com/marketplace/actions/checkout |
| @@ -31,7 +42,7 @@ jobs: | |||
| 31 | - name: Label Linked Issues | 42 | - name: Label Linked Issues |
| 32 | id: label_linked_issues | 43 | 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 '.[]'); do | 47 | for ISSUE in $(echo $issues | jq -r '.[]'); do |
| 37 | if [ "${{ github.ref }}" == "refs/heads/staging" ]; then | 48 | if [ "${{ github.ref }}" == "refs/heads/staging" ]; then |
| @@ -15,14 +15,25 @@ jobs: | |||
| 15 | mark-inactivity: | 15 | mark-inactivity: |
| 16 | name: β³ Mark Issues/PRs without Activity | 16 | name: β³ Mark Issues/PRs without Activity |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: always() | ||
| 18 | 19 | ||
| 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 Activity | 31 | - name: Mark Issues/PRs without Activity |
| 21 | # Close Stale Issues and PRs | 32 | # Close Stale Issues and PRs |
| 22 | # https://github.com/marketplace/actions/close-stale-issues | 33 | # https://github.com/marketplace/actions/close-stale-issues |
| 23 | uses: actions/stale@v9.1.0 | 34 | 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: 183 | 37 | days-before-stale: 183 |
| 27 | days-before-close: 7 | 38 | days-before-close: 7 |
| 28 | operations-per-run: 30 | 39 | operations-per-run: 30 |
| @@ -47,16 +58,27 @@ jobs: | |||
| 47 | 58 | ||
| 48 | await-user-response: | 59 | await-user-response: |
| 49 | name: β οΈ Mark Issues/PRs Awaiting User Response | 60 | name: β οΈ Mark Issues/PRs Awaiting User Response |
| 61 | needs: [mark-inactivity] | ||
| 50 | runs-on: ubuntu-latest | 62 | runs-on: ubuntu-latest |
| 51 | needs: mark-inactivity | 63 | if: always() |
| 52 | 64 | ||
| 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 Response | 76 | - name: Mark Issues/PRs Awaiting User Response |
| 55 | # Close Stale Issues and PRs | 77 | # Close Stale Issues and PRs |
| 56 | # https://github.com/marketplace/actions/close-stale-issues | 78 | # https://github.com/marketplace/actions/close-stale-issues |
| 57 | uses: actions/stale@v9.1.0 | 79 | 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: 7 | 82 | days-before-stale: 7 |
| 61 | days-before-close: 7 | 83 | days-before-close: 7 |
| 62 | operations-per-run: 30 | 84 | operations-per-run: 30 |
| @@ -74,16 +96,27 @@ jobs: | |||
| 74 | 96 | ||
| 75 | alternative-exists: | 97 | alternative-exists: |
| 76 | name: π Mark Issues with Alternative Exists | 98 | name: π Mark Issues with Alternative Exists |
| 99 | needs: [mark-inactivity, await-user-response] | ||
| 77 | runs-on: ubuntu-latest | 100 | runs-on: ubuntu-latest |
| 78 | needs: await-user-response | 101 | if: always() |
| 79 | 102 | ||
| 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 Exists | 114 | - name: Mark Issues with Alternative Exists |
| 82 | # Close Stale Issues and PRs | 115 | # Close Stale Issues and PRs |
| 83 | # https://github.com/marketplace/actions/close-stale-issues | 116 | # https://github.com/marketplace/actions/close-stale-issues |
| 84 | uses: actions/stale@v9.1.0 | 117 | 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: 7 | 120 | days-before-stale: 7 |
| 88 | days-before-close: 7 | 121 | days-before-close: 7 |
| 89 | operations-per-run: 30 | 122 | operations-per-run: 30 |
| @@ -15,14 +15,25 @@ jobs: | |||
| 15 | remove-labels: | 15 | remove-labels: |
| 16 | name: ποΈ Remove Pending Labels on Close | 16 | name: ποΈ Remove Pending Labels on Close |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: always() | ||
| 18 | 19 | ||
| 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 Close | 31 | - name: Remove Pending Labels on Close |
| 21 | # π€ Issues Helper | 32 | # π€ Issues Helper |
| 22 | # https://github.com/marketplace/actions/issues-helper | 33 | # https://github.com/marketplace/actions/issues-helper |
| 23 | uses: actions-cool/issues-helper@v3.6.0 | 34 | uses: actions-cool/issues-helper@v3.6.0 |
| 24 | with: | 35 | with: |
| 25 | actions: remove-labels | 36 | 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' |
| @@ -15,15 +15,25 @@ jobs: | |||
| 15 | label-maintainer: | 15 | label-maintainer: |
| 16 | name: π·οΈ Label if Author is a Repo Maintainer | 16 | name: π·οΈ Label if Author is a Repo Maintainer |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor) | 18 | if: always() && contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor) |
| 19 | 19 | ||
| 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 Maintainer | 31 | - name: Label if Author is a Repo Maintainer |
| 22 | # π€ Issues Helper | 32 | # π€ Issues Helper |
| 23 | # https://github.com/marketplace/actions/issues-helper | 33 | # https://github.com/marketplace/actions/issues-helper |
| 24 | uses: actions-cool/issues-helper@v3.6.0 | 34 | 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' |
| @@ -12,30 +12,11 @@ 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_PRIVATE_KEY }} | ||
| 32 | owner: ${{ github.repository_owner }} | ||
| 33 | |||
| 34 | run-eslint: | 15 | run-eslint: |
| 35 | name: β Check ESLint on PR | 16 | name: β Check ESLint on PR |
| 36 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 37 | # Only needs to run when code is changed | 18 | # 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') |
| 39 | 20 | ||
| 40 | # Override permissions, linter likely needs write access to issues | 21 | # 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-eslint | 48 | # https://github.com/marketplace/actions/action-eslint |
| 68 | uses: sibiraj-s/action-eslint@v3.0.1 | 49 | 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: true | 54 | annotations: true |
| @@ -78,7 +59,7 @@ jobs: | |||
| 78 | label-by-size: | 59 | label-by-size: |
| 79 | name: π·οΈ Label PR by Size | 60 | name: π·οΈ Label PR by Size |
| 80 | # This job should run after all others, to prevent possible concurrency issues | 61 | # 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-latest | 63 | runs-on: ubuntu-latest |
| 83 | # Only needs to run when code is changed | 64 | # 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: write | 71 | pull-requests: write |
| 91 | 72 | ||
| 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 Size | 84 | - name: Label PR Size |
| 94 | # Pull Request Size Labeler | 85 | # Pull Request Size Labeler |
| 95 | # https://github.com/marketplace/actions/pull-request-size-labeler | 86 | # https://github.com/marketplace/actions/pull-request-size-labeler |
| 96 | uses: codelytv/pr-size-labeler@v1.10.2 | 87 | 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: | |||
| 112 | 103 | ||
| 113 | label-by-branches: | 104 | label-by-branches: |
| 114 | name: π·οΈ Label PR by Branches | 105 | name: π·οΈ Label PR by Branches |
| 115 | needs: [app-auth] | ||
| 116 | runs-on: ubuntu-latest | 106 | runs-on: ubuntu-latest |
| 117 | # Only label once when PR is created or when base branch is changed, to allow manual label removal | 107 | # 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)) |
| 119 | 109 | ||
| 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 Repository | 121 | - name: Checkout Repository |
| 122 | # Checkout | 122 | # Checkout |
| 123 | # https://github.com/marketplace/actions/checkout | 123 | # https://github.com/marketplace/actions/checkout |
| @@ -129,16 +129,26 @@ jobs: | |||
| 129 | uses: actions/labeler@v5.0.0 | 129 | uses: actions/labeler@v5.0.0 |
| 130 | with: | 130 | with: |
| 131 | configuration-path: .github/pr-auto-labels-by-branch.yml | 131 | 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 }} |
| 133 | 133 | ||
| 134 | label-by-files: | 134 | label-by-files: |
| 135 | name: π·οΈ Label PR by Files | 135 | name: π·οΈ Label PR by Files |
| 136 | needs: [app-auth] | 136 | needs: [label-by-branches] |
| 137 | runs-on: ubuntu-latest | 137 | runs-on: ubuntu-latest |
| 138 | # Only needs to run when code is changed | 138 | # 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') |
| 140 | 140 | ||
| 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 Repository | 152 | - name: Checkout Repository |
| 143 | # Checkout | 153 | # Checkout |
| 144 | # https://github.com/marketplace/actions/checkout | 154 | # https://github.com/marketplace/actions/checkout |
| @@ -148,15 +158,18 @@ jobs: | |||
| 148 | # Pull Request Labeler | 158 | # Pull Request Labeler |
| 149 | # https://github.com/marketplace/actions/labeler | 159 | # https://github.com/marketplace/actions/labeler |
| 150 | uses: actions/labeler@v5.0.0 | 160 | 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.yml | 164 | 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 }} |
| 154 | 166 | ||
| 155 | remove-stale-label: | 167 | remove-stale-label: |
| 156 | name: ποΈ Remove Stale Label on Comment | 168 | name: ποΈ Remove Stale Label on Comment |
| 169 | needs: [label-by-branches, label-by-files] | ||
| 157 | runs-on: ubuntu-latest | 170 | runs-on: ubuntu-latest |
| 158 | # Only runs on comments not done by the github actions bot | 171 | # 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]') |
| 160 | 173 | ||
| 161 | # Override permissions, issue labeler needs issues write access | 174 | # Override permissions, issue labeler needs issues write access |
| 162 | permissions: | 175 | permissions: |
| @@ -165,19 +178,29 @@ jobs: | |||
| 165 | pull-requests: write | 178 | pull-requests: write |
| 166 | 179 | ||
| 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 Label | 191 | - name: Remove Stale Label |
| 169 | # π€ Issues Helper | 192 | # π€ Issues Helper |
| 170 | # https://github.com/marketplace/actions/issues-helper | 193 | # https://github.com/marketplace/actions/issues-helper |
| 171 | uses: actions-cool/issues-helper@v3.6.0 | 194 | 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' |
| 177 | 200 | ||
| 178 | check-merge-blocking-labels: | 201 | check-merge-blocking-labels: |
| 179 | name: π« Check Merge Blocking Labels | 202 | 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-latest | 204 | runs-on: ubuntu-latest |
| 182 | # Run, even if the previous jobs were skipped/failed | 205 | # Run, even if the previous jobs were skipped/failed |
| 183 | if: always() | 206 | if: always() |
| @@ -227,12 +250,22 @@ jobs: | |||
| 227 | 250 | ||
| 228 | write-auto-comments: | 251 | write-auto-comments: |
| 229 | name: π¬ Post PR Comments Based on Labels | 252 | 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-latest | 254 | runs-on: ubuntu-latest |
| 232 | # Run, even if the previous jobs were skipped/failed | 255 | # Run, even if the previous jobs were skipped/failed |
| 233 | if: always() | 256 | if: always() |
| 234 | 257 | ||
| 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 Repository | 269 | - name: Checkout Repository |
| 237 | # Checkout | 270 | # Checkout |
| 238 | # https://github.com/marketplace/actions/checkout | 271 | # https://github.com/marketplace/actions/checkout |
| @@ -244,13 +277,13 @@ jobs: | |||
| 244 | uses: peaceiris/actions-label-commenter@v1.10.0 | 277 | uses: peaceiris/actions-label-commenter@v1.10.0 |
| 245 | with: | 278 | with: |
| 246 | config_file: .github/pr-auto-comments.yml | 279 | config_file: .github/pr-auto-comments.yml |
| 247 | github_token: ${{ secrets.GITHUB_TOKEN }} | 280 | github_token: ${{ steps.app.outputs.token }} |
| 248 | 281 | ||
| 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 Merge | 284 | name: π Mark Linked Issues Done on Staging Merge |
| 252 | runs-on: ubuntu-latest | 285 | 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') |
| 254 | 287 | ||
| 255 | # Override permissions, We need to be able to write to issues | 288 | # Override permissions, We need to be able to write to issues |
| 256 | permissions: | 289 | permissions: |
| @@ -259,6 +292,16 @@ jobs: | |||
| 259 | pull-requests: write | 292 | pull-requests: write |
| 260 | 293 | ||
| 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 Description | 305 | - name: Extract Linked Issues From PR Description |
| 263 | id: extract_issues | 306 | 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_ENV | 318 | echo "linked_issues=$ISSUES" >> $GITHUB_ENV |
| 276 | 319 | ||
| 277 | - name: Merge Issue Lists | 320 | - name: Merge Issue Lists |
| @@ -283,7 +326,7 @@ jobs: | |||
| 283 | - name: Label Linked Issues | 326 | - name: Label Linked Issues |
| 284 | id: label_linked_issues | 327 | 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 '.[]'); do | 331 | 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" |
| @@ -15,14 +15,25 @@ jobs: | |||
| 15 | check-merge-conflicts: | 15 | check-merge-conflicts: |
| 16 | name: βοΈ Check Merge Conflicts | 16 | name: βοΈ Check Merge Conflicts |
| 17 | runs-on: ubuntu-latest | 17 | runs-on: ubuntu-latest |
| 18 | if: always() | ||
| 18 | 19 | ||
| 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 Conflicts | 31 | - name: Check Merge Conflicts |
| 21 | # Label Conflicting Pull Requests | 32 | # Label Conflicting Pull Requests |
| 22 | # https://github.com/marketplace/actions/label-conflicting-pull-requests | 33 | # https://github.com/marketplace/actions/label-conflicting-pull-requests |
| 23 | uses: eps1lon/actions-label-merge-conflict@v3.0.3 | 34 | 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. |