From 19e486dd02661e2eb60d08f609c1aa7fe08b8b32 Mon Sep 17 00:00:00 2001 From: steveluscher Date: Thu, 8 Dec 2022 20:14:50 +0000 Subject: [PATCH] chore: a stalebot to close inactive issues and PRs --- .github/stale.yml | 41 ------------------ .../workflows/manage-stale-issues-and-prs.yml | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 41 deletions(-) delete mode 100644 .github/stale.yml create mode 100644 .github/workflows/manage-stale-issues-and-prs.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index b3b0b17a9554f2..00000000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,41 +0,0 @@ -# Issues with these labels will never be considered stale -exemptLabels: - - security - - blocked - -# Label to use when marking a pull request as stale -staleLabel: stale - -pulls: - # Number of days of inactivity before a pull request becomes stale - daysUntilStale: 7 - - # Number of days of inactivity before a stale pull request is closed - daysUntilClose: 7 - # Comment to post when marking a pull request as stale. Set to `false` to disable - markComment: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. - - # Comment to post when closing a stale pull request. Set to `false` to disable - closeComment: > - This stale pull request has been automatically closed. - Thank you for your contributions. - -issues: - # Number of days of inactivity before a issue becomes stale - daysUntilStale: 365 - - # Number of days of inactivity before a stale issue is closed - daysUntilClose: 7 - # Comment to post when marking a issue as stale. Set to `false` to disable - markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. - - # Comment to post when closing a stale issue. Set to `false` to disable - closeComment: > - This stale issue has been automatically closed. - Thank you for your contributions. - - diff --git a/.github/workflows/manage-stale-issues-and-prs.yml b/.github/workflows/manage-stale-issues-and-prs.yml new file mode 100644 index 00000000000000..772aae4e62815d --- /dev/null +++ b/.github/workflows/manage-stale-issues-and-prs.yml @@ -0,0 +1,43 @@ +name: "Manage stale issues and PRs" +on: + # Chosen to be just before London wakes up and way past San Francisco's bedtime. + schedule: + - cron: "0 8 * * 1-5" # This is in UTC. + # Do a dry-run (debug-only: true) whenever this workflow itself is changed. + pull_request: + paths: + - .github/workflows/manage-stale-issues-and-prs.yml + types: + - opened + - synchronize + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v6 + with: + ascending: true # Spend API operations budget on older, more-likely-to-get-closed issues first + close-issue-message: "" # Leave no comment when closing + close-pr-message: "" # Leave no comment when closing + days-before-issue-stale: 7 + days-before-pr-stale: 14 + days-before-close: 7 + debug-only: ${{ github.event_name == 'pull_request' }} # Dry-run when true. + exempt-all-milestones: true # Milestones can sometimes last a month, so exempt issues attached to a milestone. + exempt-issue-labels: blocked,do-not-close,feature-gate,security + exempt-pr-labels: blocked,do-not-close,feature-gate,security + # No actual changes get made in debug-only mode, so we can raise the operations ceiling. + operations-per-run: ${{ github.event_name == 'pull_request' && 100 || 30}} + stale-issue-label: stale + stale-issue-message: "" # Leave no comment when marking as stale + stale-pr-label: stale + stale-pr-message: "" # Leave no comment when marking as stale + # Time immemorial when in debug-only mode (ie. on pull requests). + # `STALEBOT_START_DATE` otherwise. + # You can use this as a killswitch by setting `STALEBOT_START_DATE` in the far future. + start-date: ${{ github.event_name == 'pull_request' && '1970-01-01T00:00:00Z' || secrets.STALEBOT_START_DATE }} # ISO 8601 or RFC 2822