Skip to content

Issue Comment Workflows #20

Issue Comment Workflows

Issue Comment Workflows #20

# -----------------------------------------------------------------------------
# GitHub Actions Workflow: Issue Comments
# Description: Post issue comments
# Jobs:
# - Assigned comment
# - Stale label comment
# -----------------------------------------------------------------------------
name: Issue Comment Workflows
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. ✨**
---
Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you!
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!. 🌸`
})
# 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.`
})