name: Stale and close inactive issues/PRs on: schedule: - cron: "0 0,6,12,18 * * *" # every 6 hours o'clock... 0:00am 6:00am 12:00pm 18:00pm workflow_dispatch: # or manually permissions: issues: read pull-requests: read # This allows a subsequently queued workflow run to interrupt previous runs concurrency: group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref || github.run_id }}' cancel-in-progress: true jobs: process-issues: name: Process Issues permissions: issues: write runs-on: ubuntu-latest steps: - uses: actions/stale@v5 with: operations-per-run: 30 days-before-issue-stale: 60 days-before-issue-close: 30 stale-issue-label: "stale" close-issue-label: "stale: closed" stale-issue-message: | This issue has been automatically marked as stale because it has not had activity during the last 60 days. It will be closed if no further activity occurs on the next 30 days. Thank you for your contributions. close-issue-message: | This issue has been automatically closed because it has been inactive during the last 30 days since being marked as stale. Anyway, thank you for your contributions. remove-issue-stale-when-updated: true exempt-issue-labels: "👥 discussion,👀 Needs Review,📌 pinned" days-before-pr-stale: -1 days-before-pr-close: -1 process-prs: name: Process Pull Requests permissions: pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/stale@v5 with: operations-per-run: 30 days-before-pr-stale: 60 days-before-pr-close: 30 stale-pr-label: "stale" close-pr-label: "stale: closed" stale-pr-message: | This pull request has been automatically marked as stale because it has not had activity during the last 60 days. It will be closed if no further activity occurs on the next 30 days. Thank you for your contributions. close-pr-message: | This pull request has been automatically closed because it has been inactive during the last 30 days since being marked as stale. Anyway, thank you for your contributions. remove-pr-stale-when-updated: true exempt-pr-labels: "👥 discussion,👀 Needs Review" exempt-draft-pr: true days-before-issue-stale: -1 days-before-issue-close: -1 reporter: name: GitHub reporter needs: [process-issues, process-prs] runs-on: ubuntu-latest steps: - run: | echo "### Staled issues" \ >> $GITHUB_STEP_SUMMARY echo "$STALED_ISSUES" \ | jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)): \(.title)") | join("\n")' \ >> $GITHUB_STEP_SUMMARY echo "### Staled pull requests" \ >> $GITHUB_STEP_SUMMARY echo "$STALED_PRS" \ | jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)): \(.title)") | join("\n")' \ >> $GITHUB_STEP_SUMMARY echo "### Closed issues" \ >> $GITHUB_STEP_SUMMARY echo "$CLOSED_ISSUES" \ | jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_ISSUES_URL)/\(.number)): \(.title)") | join("\n")' \ >> $GITHUB_STEP_SUMMARY echo "### Closed pull requests" \ >> $GITHUB_STEP_SUMMARY echo "$CLOSED_PRS" \ | jq --raw-output 'map("* [#\(.number)](\(env.GITHUB_PULL_URL)/\(.number)): \(.title)") | join("\n")' \ >> $GITHUB_STEP_SUMMARY env: GITHUB_REPO_URL: ${{ format('{0}/{1}', github.server_url, github.repository) }} GITHUB_ISSUES_URL: ${{ format('{0}/{1}/issues', github.server_url, github.repository) }} GITHUB_PULL_URL: ${{ format('{0}/{1}/pull', github.server_url, github.repository) }} STALED_ISSUES: ${{ needs.process-issues.outputs.staled-issues-prs }} CLOSED_ISSUES: ${{ needs.process-issues.outputs.closed-issues-prs }} STALED_PRS: ${{ needs.process-prs.outputs.staled-issues-prs }} CLOSED_PRS: ${{ needs.process-prs.outputs.closed-issues-prs }}