|
| 1 | +name: "Stale Issues and PRs" |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: "30 23 * * *" |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + debugOnly: |
| 8 | + description: "Set to true for a dry run" |
| 9 | + required: false |
| 10 | + default: "false" |
| 11 | + |
| 12 | +jobs: |
| 13 | + stale: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Set environment variables |
| 17 | + id: set-stale-action-env |
| 18 | + run: | |
| 19 | + echo "STALE_ISSUE_MESSAGE=This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days." >> $GITHUB_ENV |
| 20 | + echo "STALE_PR_MESSAGE=This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days." >> $GITHUB_ENV |
| 21 | + echo "CLOSE_ISSUE_MESSAGE=This issue was closed because it has been stalled for 90 days with no activity." >> $GITHUB_ENV |
| 22 | + echo "CLOSE_PR_MESSAGE=This PR was closed because it has been stalled for 90 days with no activity." >> $GITHUB_ENV |
| 23 | + echo "DAYS_BEFORE_STALE=60" >> $GITHUB_ENV |
| 24 | + # DAYS_BEFORE_CLOSE is set to 30 because the we want to close the issue/PR after 90 days total (DAYS_BEFORE_STALE value is 60) |
| 25 | + echo "DAYS_BEFORE_CLOSE=30" >> $GITHUB_ENV |
| 26 | + echo "STALE_ISSUE_LABEL=stale" >> $GITHUB_ENV |
| 27 | + echo "STALE_PR_LABEL=stale" >> $GITHUB_ENV |
| 28 | +
|
| 29 | + - name: Stale issues and PRs |
| 30 | + id: stale-issues-or-prs |
| 31 | + uses: actions/stale@v3 |
| 32 | + with: |
| 33 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + debug-only: ${{ github.event.inputs.debugOnly }} |
| 35 | + stale-issue-message: ${{ env.STALE_ISSUE_MESSAGE }} |
| 36 | + stale-pr-message: ${{ env.STALE_PR_MESSAGE }} |
| 37 | + close-issue-message: ${{ env.CLOSE_ISSUE_MESSAGE }} |
| 38 | + close-pr-message: ${{ env.CLOSE_PR_MESSAGE }} |
| 39 | + days-before-stale: ${{ env.DAYS_BEFORE_STALE }} |
| 40 | + days-before-close: ${{ env.DAYS_BEFORE_CLOSE }} |
| 41 | + stale-issue-label: ${{ env.STALE_ISSUE_LABEL }} |
| 42 | + stale-pr-label: ${{ env.STALE_PR_LABEL }} |
0 commit comments