Skip to content

Commit

Permalink
Actions: comments & stale management (#466)
Browse files Browse the repository at this point in the history
Updated stale workflow to include PRs
Upgraded assignee issue comment with markdown using github/script
New first interaction workflow for contributors who open PRs without being assigned issues
  • Loading branch information
kyleecodes authored Jun 7, 2024
1 parent 2c7ea2e commit d84097b
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 58 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/community-first-pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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!"
35 changes: 35 additions & 0 deletions .github/workflows/community-issue-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow handles issue comments.

name: Issue Assignee Comment

on:
issues:
types:
- assigned
- labeled

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:
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({
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 ✨**
---
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). 🌸`
})
43 changes: 43 additions & 0 deletions .github/workflows/community-stale-management.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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

name: Mark 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-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."
stale-issue-message: "As per Chayn policy, after 30 days of inactivity, we will be unassigning this issue. Please comment to stay assigned."
23 changes: 0 additions & 23 deletions .github/workflows/new-assignee-comment.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/stale-issue-management.yml

This file was deleted.

0 comments on commit d84097b

Please sign in to comment.