From b2c73f8325ae059a4dec86fca42c7dead6839b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 29 May 2023 22:02:38 +0200 Subject: [PATCH 1/3] Do not try to remove stale lables on PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- .github/workflows/stale.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fe28112c..af3177d4 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -29,8 +29,11 @@ jobs: operations-per-run: 300 close-issue-reason: 'not_planned' - remove_stale: # trigger "stale" removal immediately when stale issues are commented on - if: github.event_name == 'issue_comment' + remove_stale: + # trigger "stale" removal immediately when stale issues are commented on + # we need to explicitly check that the trigger does not run on comment on a PR as + # 'issue_comment' triggers on issues AND PR comments + if: github.event_name == 'issue_comment' && ${{ !github.event.issue.pull_request }} permissions: contents: read # for actions/checkout issues: write # to edit issues label From 364537b32459d3c5871f8dde0d9cad5b7e12b008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Wed, 31 May 2023 22:14:05 +0200 Subject: [PATCH 2/3] Use env variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- .github/workflows/stale.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index af3177d4..0d06ee22 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -23,7 +23,7 @@ jobs: days-before-stale: 30 days-before-close: 5 stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.' - stale-issue-label: $stale_label + stale-issue-label: '${{ env.stale_label }}' exempt-issue-labels: 'Internal, Fixed in next release, Bug: Confirmed, Documentation Needed' exempt-all-issue-assignees: true operations-per-run: 300 @@ -42,7 +42,6 @@ jobs: - name: Checkout uses: actions/checkout@v3.5.2 - name: Remove 'stale' label - run: gh issue edit ${{ github.event.issue.number }} --remove-label $stale_label - env: + run: gh issue edit ${{ github.event.issue.number }} --remove-label ${{ env.stale_label }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 80091232a767efd28277e90e008c643266e06577 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 12 Jul 2023 21:31:19 +0100 Subject: [PATCH 3/3] Add missing `env:`, tweak conditional Signed-off-by: Adam Warner --- .github/workflows/stale.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0d06ee22..458a7fb6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -32,8 +32,8 @@ jobs: remove_stale: # trigger "stale" removal immediately when stale issues are commented on # we need to explicitly check that the trigger does not run on comment on a PR as - # 'issue_comment' triggers on issues AND PR comments - if: github.event_name == 'issue_comment' && ${{ !github.event.issue.pull_request }} + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only + if: ${{ !github.event.issue.pull_request && github.event_name != 'schedule' }} permissions: contents: read # for actions/checkout issues: write # to edit issues label @@ -43,5 +43,6 @@ jobs: uses: actions/checkout@v3.5.2 - name: Remove 'stale' label run: gh issue edit ${{ github.event.issue.number }} --remove-label ${{ env.stale_label }} + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}