Stale Pull Requests #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Stale Pull Requests | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '37 2 * * *' | |
| jobs: | |
| stale: | |
| name: Mark and close stale pull requests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: Ensure stale label exists | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const label = 'stale'; | |
| try { | |
| await github.rest.issues.getLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: label, | |
| }); | |
| } catch (error) { | |
| if (error.status !== 404) { | |
| throw error; | |
| } | |
| await github.rest.issues.createLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: label, | |
| color: 'ededed', | |
| description: 'Pull requests with no recent activity', | |
| }); | |
| } | |
| - name: Mark and close stale pull requests | |
| uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0 | |
| with: | |
| days-before-issue-stale: -1 | |
| days-before-issue-close: -1 | |
| days-before-pr-stale: 7 | |
| days-before-pr-close: 7 | |
| stale-pr-label: stale | |
| stale-pr-message: | | |
| This pull request has been inactive for 7 days and has been marked stale. It will be closed in 7 days if there is no further activity. | |
| close-pr-message: | | |
| This pull request was closed because it was stale for 7 days without further activity. Reopen it or open a new pull request when you are ready to continue. | |
| exempt-pr-labels: wip,nomerge | |
| exempt-draft-pr: true | |
| operations-per-run: 100 |