From fb62d05f35ce8fecd54ff5ddabc5ed699d639f60 Mon Sep 17 00:00:00 2001 From: kyleecodes Date: Mon, 11 Nov 2024 07:35:03 -0500 Subject: [PATCH] Actions:community cleanup --- .../workflows/community-first-pr-comment.yml | 16 --- .github/workflows/community-issue-comment.yml | 106 ++++++++++-------- .../workflows/community-stale-management.yml | 86 +++++++------- 3 files changed, 104 insertions(+), 104 deletions(-) delete mode 100644 .github/workflows/community-first-pr-comment.yml diff --git a/.github/workflows/community-first-pr-comment.yml b/.github/workflows/community-first-pr-comment.yml deleted file mode 100644 index 18948e33..00000000 --- a/.github/workflows/community-first-pr-comment.yml +++ /dev/null @@ -1,16 +0,0 @@ -# This workflow comments on PRs opened by first time contributors. -# Reminds first timer contributors to associate their PR with an issue and follow the guidelines. -# See for more info: https://github.com/actions/first-interaction - -name: First Interaction PR Comment - -on: [pull_request] - -jobs: - greeting: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - pr-message: "First time contributors to Chayn: Please make sure that this PR is linked to an issue you are assigned! We will not merge contributor PRs without a linked assigned issue. Please ask to be assigned an existing issue or create your own before opening a PR. Read our Contributing Guidelines in the CONTRIBUTING.md file for more details. Thank you for your contribution!" diff --git a/.github/workflows/community-issue-comment.yml b/.github/workflows/community-issue-comment.yml index 139e0f24..ac471765 100644 --- a/.github/workflows/community-issue-comment.yml +++ b/.github/workflows/community-issue-comment.yml @@ -1,56 +1,68 @@ -# This workflow handles issue comments. -# See for more info: https://github.com/actions/github-script +# ----------------------------------------------------------------------------- +# GitHub Actions Workflow: Issue Comments +# Description: Post issue comments +# Jobs: +# - Assigned comment +# - Stale label comment +# ----------------------------------------------------------------------------- -name: Issue Comments + name: Issue Comment Workflows -on: - issues: - types: - - assigned - - labeled - -jobs: - # When issues are assigned, a comment is posted - # Tags the assignee with links to helpful resources - assigned-comment: - if: github.event.action == 'assigned' - runs-on: ubuntu-latest - steps: - - name: Post assignee issue comment - id: assigned-comment - uses: actions/github-script@v7 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.rest.issues.createComment({ + on: + workflow_run: + workflows: ["Label Stale Contributions"] + types: + - completed + issues: + types: + - assigned + - labeled + + jobs: + # Job: Assigned issue comment + # Trigger: Issues are assigned + # Returns: Posts comment tagging assignee and helpful message + assigned-comment: + if: github.event.action == 'assigned' + runs-on: ubuntu-latest + steps: + - name: Post assignee issue comment + id: assigned-comment + uses: actions/github-script@v7 # https://github.com/actions/github-script + 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: `Thank you @${context.payload.issue.assignee.login} you have been assigned this issue! - **Please follow the directions in our [Contributing Guide](https://github.com/chaynHQ/.github/blob/main/docs/CONTRIBUTING.md). We look forward to reviewing your pull request shortly ✨** - + **Please follow the directions in our [Contributing Guide](https://github.com/chaynHQ/.github/blob/main/docs/CONTRIBUTING.md). We look forward to reviewing your pull request. ✨** + --- - + 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). 🌸` + Learn more about our [impact](https://github.com/chaynHQ/.github/blob/main/profile/README.md) and [sign-up for our volunteer programs](https://www.chayn.co/get-involved) to join our mission!. 🌸` }) - - # 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.` - }) + + # Job: Stale label comment + # Triggers: + # Labeled as stale by maintainer + # 'Label Stale Contributions' workflow runs + # Returns: Posts warning comment tagging assignee + 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 # https://github.com/actions/github-script + 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.` + }) \ No newline at end of file diff --git a/.github/workflows/community-stale-management.yml b/.github/workflows/community-stale-management.yml index 0fa63dcd..05841731 100644 --- a/.github/workflows/community-stale-management.yml +++ b/.github/workflows/community-stale-management.yml @@ -1,43 +1,47 @@ -# This workflow labels stale issues and PRs after 30 days of inactivity. -# Stale PRs are closed after 1 week of inactivity after labeled stale. -# See for more info: https://github.com/actions/stale +# ----------------------------------------------------------------------------- +# GitHub Actions Workflow: Label Stale Contributions +# Description: Labels stale contributions +# Job: actions/stale +# ----------------------------------------------------------------------------- -name: Mark Stale Contributions + name: Label Stale Contributions -on: - # Enable manual run from the Actions tab so workflow can be run at any time - workflow_dispatch: - # Scheduled to run at 12:00 on every Monday - schedule: - - cron: "0 0 * * MON" - -jobs: - stale: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v9 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-label: "stale" - stale-pr-label: "stale" - days-before-stale: 30 - # disables closing issues - days-before-issue-close: -1 - # close pr after 1 week no updates after stale warning - days-before-pr-close: 7 - # only scan assigned issues - include-only-assigned: true - # ignore issues assigned to staff and bots - exempt-assignees: "kyleecodes, swetha-charles, eleanorreem, annarhughes, tarebyte, dependabot[bot], dependabot, github-actions[bot], github-actions" - # disable removing stale label due to irrelevant activity (like branch updates) - remove-stale-when-updated: false - # exempt dependabot prs from going stale - exempt-pr-labels: dependencies - # disable counting irrelevant activity (branch updates) towards day counter on prs. - 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." + on: + workflow_dispatch: # enables manual trigger + # Scheduled to run at 12:00 on every Monday + schedule: + - cron: "0 0 * * MON" + + jobs: + # Trigger: Scheduled weekly + # Returns: labels issues and PRs with 'stale' after 30 days inactivity + # PRs: automated closing after 1 more week of inactivity + # Issues: requires manual closing by maintainers + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v9 # https://github.com/actions/stale + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-label: "stale" + stale-pr-label: "stale" + days-before-stale: 30 + # disables closing issues + days-before-issue-close: -1 + days-before-pr-close: 7 + # only scan assigned issues + include-only-assigned: true + # ignore issues assigned to staff and bots + exempt-assignees: "kyleecodes, swetha-charles, eleanorreem, annarhughes, tarebyte, dependabot[bot], dependabot, github-actions[bot], github-actions" + # disable removing stale label due to irrelevant activity (like branch updates) + remove-stale-when-updated: false + # exempt dependabot prs from going stale + exempt-pr-labels: dependencies + # disable counting irrelevant activity (branch updates) towards day counter on prs. + ignore-pr-updates: true + # actions/stale does not enable tagging authors / assignees, so comments are handled by Issue Comments Workflows. + stale-pr-message: "As per Chayn policy, after 30 days of inactivity, we will close this PR in 7 days. Please comment or update to keep open."