From 4edea655493c49f779e909dbbd2484b37e0c52d5 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 16 Oct 2024 22:56:45 +0000 Subject: [PATCH 1/5] [CI/Build] Add bot to close stale issues and PRs This commit adds configuration to run the `actions/stale` github action that closes stale issues and PRs. Further discussion is in the issue. Closes #9435 Signed-off-by: Russell Bryant --- .github/workflows/stale.yml | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000000..db48fb014013c --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,57 @@ +name: 'Close stale issues and PRs' + +on: + schedule: + # Daily at 1:30 AM UTC + - cron: '30 1 * * *' + +env: + LC_ALL: en_US.UTF-8 + +defaults: + run: + shell: bash + +permissions: + contents: read + +jobs: + stale: + permissions: + issues: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: "Stale Action" + uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + with: + # Apply the `stale` label to an issue with no activity for 90 days. + days-before-issue-stale: 90 + # Close the issue if no activity occurs within 30 days after being + # marked as stale. + days-before-issue-close: 30 + stale-issue-label: 'stale' + stale-issue-message: > + This issue has been automatically marked as stale because it has not + had activity within 90 days. It will be automatically closed if no + further activity occurs within 30 days. Leave a comment if + you feel this issue should remain open. Thank you! + close-issue-message: > + This issue has been automatically closed due to inactivity. Please + feel free to reopen if you feel it is still relevant. Thank you! + + # Apply the `stale` label to a pull request with no activity for 90 days. + days-before-pr-stale: 90 + # Close the pull request if no activity occurs within 30 days after + # being marked as stale. + days-before-pr-close: 30 + stale-pr-label: 'stale' + stale-pr-message: > + This pull request has been automatically marked as stale because it + has not had activity within 90 days. It will be automatically + closed if no further activity occurs within 30 days. Leave a comment + if you feel this pull request should remain open. Thank you! + close-pr-message: > + This pull request has been automatically closed due to inactivity. + Please feel free to reopen if you intend to continue working on it. + Thank you! From 36a3979cac83923c23bf26e8a588fdd0cfa10cbd Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 17 Oct 2024 13:00:42 -0400 Subject: [PATCH 2/5] Apply suggestions from code review Apply suggested edits from @hmellor. Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- .github/workflows/stale.yml | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index db48fb014013c..10d930a6f5995 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,54 +1,37 @@ -name: 'Close stale issues and PRs' +name: 'Close inactive issues and PRs' on: schedule: # Daily at 1:30 AM UTC - cron: '30 1 * * *' -env: - LC_ALL: en_US.UTF-8 - -defaults: - run: - shell: bash - -permissions: - contents: read - jobs: - stale: + close-issues-and-pull-requests: permissions: issues: write pull-requests: write runs-on: ubuntu-latest steps: - - name: "Stale Action" uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: - # Apply the `stale` label to an issue with no activity for 90 days. days-before-issue-stale: 90 - # Close the issue if no activity occurs within 30 days after being - # marked as stale. days-before-issue-close: 30 stale-issue-label: 'stale' stale-issue-message: > This issue has been automatically marked as stale because it has not - had activity within 90 days. It will be automatically closed if no + had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this issue should remain open. Thank you! close-issue-message: > This issue has been automatically closed due to inactivity. Please feel free to reopen if you feel it is still relevant. Thank you! - # Apply the `stale` label to a pull request with no activity for 90 days. days-before-pr-stale: 90 - # Close the pull request if no activity occurs within 30 days after - # being marked as stale. days-before-pr-close: 30 stale-pr-label: 'stale' stale-pr-message: > This pull request has been automatically marked as stale because it - has not had activity within 90 days. It will be automatically + has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you! close-pr-message: > From 4290af0fc9d077256c90cb64545e93cf6c81bedd Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 17 Oct 2024 17:02:28 +0000 Subject: [PATCH 3/5] ci: Fix syntax error after applying suggested edits from review Signed-off-by: Russell Bryant --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 10d930a6f5995..f34dde350d392 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: days-before-issue-stale: 90 days-before-issue-close: 30 From 11caf27b0d3d2d3895487c3bd46fd2256707d27c Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 18 Oct 2024 15:27:33 +0000 Subject: [PATCH 4/5] stale: Ignore drafts and issues/prs with `keep-open` label Signed-off-by: Russell Bryant --- .github/workflows/stale.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f34dde350d392..3aa24b00b731d 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,6 +14,10 @@ jobs: steps: - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: + exempt-draft-pr: true + exempt-issue-labels: 'keep-open' + exempt-pr-labels: 'keep-open' + days-before-issue-stale: 90 days-before-issue-close: 30 stale-issue-label: 'stale' From d70b50a9491d8c9db033c6c16ce93fb28b58037d Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 18 Oct 2024 13:02:51 -0400 Subject: [PATCH 5/5] Update .github/workflows/stale.yml Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- .github/workflows/stale.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3aa24b00b731d..becf2f4f74616 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -18,6 +18,9 @@ jobs: exempt-issue-labels: 'keep-open' exempt-pr-labels: 'keep-open' + labels-to-add-when-unstale: 'unstale' + labels-to-remove-when-stale: 'unstale' + days-before-issue-stale: 90 days-before-issue-close: 30 stale-issue-label: 'stale'