From 5da31f0dee165a0ce2c8abd181c20b3430ef84a2 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Wed, 29 Jan 2025 15:12:27 +1100 Subject: [PATCH] Stale issue workflow improvements (#409) * Creating a new workflow to handle extending stale deadlines and some tweaks to identifying stale issues * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/remove-stale-label.yml | 38 ++++++++++++++++++++++++ .github/workflows/stale-issues.yml | 26 +++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/remove-stale-label.yml diff --git a/.github/workflows/remove-stale-label.yml b/.github/workflows/remove-stale-label.yml new file mode 100644 index 00000000..c3be693e --- /dev/null +++ b/.github/workflows/remove-stale-label.yml @@ -0,0 +1,38 @@ +name: Remove stale label on comment + +on: + issue_comment: + types: [created] + +permissions: + issues: write + pull-requests: write + +jobs: + remove-stale-label: + if: github.event.comment.body == '/stale-extend' + runs-on: ubuntu-latest + steps: + - name: Remove stale label from pull request + uses: "actions/github-script@v7" + with: + script: | + github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + name: 'stale' + }); + if: github.event_name == 'pull_request' + + - name: Remove stale label from issue + uses: "actions/github-script@v7" + with: + script: | + github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.issue.number, + name: 'stale' + }); + if: github.event_name == 'issue' diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index f1a4dc66..a8409330 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -24,21 +24,24 @@ jobs: steps: - uses: actions/stale@v9 + name: Standard issue and PR stale bot with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 21 days-before-close: 14 enable-statistics: true - any-of-labels: "Awaiting Response" + exempt-issue-labels: "awaiting-response" + exempt-pr-labels: "awaiting-response" remove-stale-when-updated: true - stale-issue-message: "We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it." - stale-pr-message: "We have noticed this PR has not been updated within 21 days. If there is no action on this PR in the next 14 days, we will automatically close it." + stale-issue-message: "We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use `/stale-extend` to extend the window." + stale-pr-message: "We have noticed this PR has not been updated within 21 days. If there is no action on this PR in the next 14 days, we will automatically close it. You can use `/stale-extend` to extend the window." close-issue-message: "This issue has been stale for 5 weeks and has been automatically closed." close-pr-message: "This PR has been stale for 5 weeks and has been automatically closed." stale-issue-label: "stale" stale-pr-label: "stale" - uses: actions/stale@v9 + name: Question and Resolved issue stale bot with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 5 @@ -46,5 +49,20 @@ jobs: enable-statistics: true only-issue-labels: "Question,Resolved" remove-stale-when-updated: true - stale-issue-message: "We have noticed this issue has been resolved for 5 days. If there is not action on this issue in the next 2 days, we will automatically close it." + stale-issue-message: "We have noticed this issue has been resolved for 5 days. If there is no action on this issue in the next 2 days, we will automatically close it. You can use `/stale-extend` to extend the window." stale-issue-label: "stale" + + - uses: actions/stale@v9 + name: Awaiting response issue and PR stale bot + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 7 + days-before-close: 3 + enable-statistics: true + only-issue-labels: "awaiting-response" + only-pr-labels: "awaiting-response" + remove-stale-when-updated: true + stale-issue-message: "We have noticed this issue has been awaiting response for 7 days. If there is no action on this issue in the next 3 days, we will automatically close it. You can use `/stale-extend` to extend the window." + stale-pr-message: "We have noticed this PR has been awaiting response for 7 days. If there is no action on this PR in the next 3 days, we will automatically close it. You can use `/stale-extend` to extend the window." + stale-issue-label: "stale" + stale-pr-label: "stale"