Directly remove stale labels on comments
| @@ -1,17 +1,24 @@ | ||
| 1 | 1 | name: π― Close Stale Issues/PRs Workflow |
| 2 | 2 | |
| 3 | 3 | on: |
| 4 | + # Run the workflow every day | |
| 4 | 5 | workflow_dispatch: |
| 5 | 6 | schedule: |
| 6 | 7 | - cron: '0 0 * * *' # Runs every day at midnight UTC |
| 8 | + # Re also listen to comment created events or new PR pushes, to remove stale labels right away | |
| 7 | 9 | issue_comment: |
| 8 | 10 | types: [created] |
| 9 | - | |
| 11 | + pull_request_review_comment: | |
| 12 | + types: [created] | |
| 13 | + pull_request: | |
| 14 | + types: [synchronize] | |
| 10 | 15 | |
| 11 | 16 | jobs: |
| 12 | 17 | mark-inactivity: |
| 13 | 18 | name: Mark Issues/PRs without Activity |
| 14 | 19 | runs-on: ubuntu-latest |
| 20 | + # Only run this on the actual scheduled workflow | |
| 21 | + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| 15 | 22 | |
| 16 | 23 | steps: |
| 17 | 24 | - name: Mark Issues/PRs without Activity |
| @@ -41,12 +48,13 @@ jobs: | ||
| 41 | 48 | close-pr-label: 'πΈοΈ Inactive' |
| 42 | 49 | exempt-issue-labels: 'π Keep Open' |
| 43 | 50 | exempt-pr-labels: 'π Keep Open' |
| 44 | - labels-to-add-when-unstale: 'π Keep Open' | |
| 45 | 51 | |
| 46 | 52 | await-user-response: |
| 47 | 53 | name: Mark Issues/PRs Awaiting User Response |
| 48 | 54 | runs-on: ubuntu-latest |
| 49 | 55 | needs: mark-inactivity |
| 56 | + # Only run this on the actual scheduled workflow | |
| 57 | + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| 50 | 58 | |
| 51 | 59 | steps: |
| 52 | 60 | - name: Mark Issues/PRs Awaiting User Response |
| @@ -74,6 +82,8 @@ jobs: | ||
| 74 | 82 | name: Mark Issues with Alternative Exists |
| 75 | 83 | runs-on: ubuntu-latest |
| 76 | 84 | needs: await-user-response |
| 85 | + # Only run this on the actual scheduled workflow | |
| 86 | + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| 77 | 87 | |
| 78 | 88 | steps: |
| 79 | 89 | - name: Mark Issues with Alternative Exists |
| @@ -96,4 +106,19 @@ jobs: | ||
| 96 | 106 | stale-issue-label: 'π Awaiting User Response' |
| 97 | 107 | close-issue-label: 'πΈοΈ Inactive' |
| 98 | 108 | exempt-issue-labels: 'π Keep Open' |
| 99 | - labels-to-add-when-unstale: 'π Keep Open' | |
| 109 | + | |
| 110 | + remove-stale-label: | |
| 111 | + name: Remove Stale Label on Comment | |
| 112 | + runs-on: ubuntu-latest | |
| 113 | + # Only run this on new comments or PR commits, to automatically remove the stale label | |
| 114 | + if: (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'pull_request') && github.actor != 'github-actions[bot]' | |
| 115 | + | |
| 116 | + steps: | |
| 117 | + - name: Remove Stale Label | |
| 118 | + # π€ Issues Helper | |
| 119 | + # https://github.com/marketplace/actions/issues-helper | |
| 120 | + uses: actions-cool/issues-helper@v3 | |
| 121 | + with: | |
| 122 | + actions: 'remove-labels' | |
| 123 | + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | |
| 124 | + labels: 'β°οΈ Stale,πΈοΈ Inactive,π Awaiting User Response,π No Response' | |