From 325b1e7bc50ed2b73b3630833f60e679887ee10b Mon Sep 17 00:00:00 2001 From: kyleecodes Date: Wed, 12 Jun 2024 19:30:26 -0400 Subject: [PATCH] Actions: enable stale issue management --- .github/workflows/community-issue-comment.yml | 25 +++++++++++++++++-- .../workflows/community-stale-management.yml | 1 - 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/community-issue-comment.yml b/.github/workflows/community-issue-comment.yml index 05ccf99d..139e0f24 100644 --- a/.github/workflows/community-issue-comment.yml +++ b/.github/workflows/community-issue-comment.yml @@ -1,6 +1,7 @@ # This workflow handles issue comments. +# See for more info: https://github.com/actions/github-script -name: Issue Assignee Comment +name: Issue Comments on: issues: @@ -11,8 +12,8 @@ on: jobs: # When issues are assigned, a comment is posted # Tags the assignee with links to helpful resources - # See for more info: https://github.com/actions/github-script assigned-comment: + if: github.event.action == 'assigned' runs-on: ubuntu-latest steps: - name: Post assignee issue comment @@ -33,3 +34,23 @@ jobs: Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you! Learn more about Chayn [here](https://linktr.ee/chayn) and [explore our projects](https://org.chayn.co/projects). 🌸` }) + + # When issues are labeled as stale, a comment is posted. + # Tags the assignee with warning. + # Enables manual issue management in addition to community-stale-management.yml + stale-label-comment: + if: github.event.action == 'labeled' && github.event.label.name == 'stale' + runs-on: ubuntu-latest + steps: + - name: Post stale issue comment + id: stale-label-comment + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.issue.number, + body: `@${context.payload.issue.assignee.login} As per Chayn policy, after 30 days of inactivity, we will be unassigning this issue. Please comment to stay assigned.` + }) diff --git a/.github/workflows/community-stale-management.yml b/.github/workflows/community-stale-management.yml index 8408ef6d..0fa63dcd 100644 --- a/.github/workflows/community-stale-management.yml +++ b/.github/workflows/community-stale-management.yml @@ -41,4 +41,3 @@ jobs: ignore-pr-updates: true stale-pr-message: "As per Chayn policy, after 30 days of inactivity, we will close this PR." close-pr-message: "This PR has been closed due to inactivity." - stale-issue-message: "As per Chayn policy, after 30 days of inactivity, we will be unassigning this issue. Please comment to stay assigned."