Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions workflow to greet new contributors #37

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/greeting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Greet New Contributors

on:
issues:
types: [opened]
pull_request:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Greet for issue
if: github.event_name == 'issues' && github.event.action == 'opened'
uses: actions/github-script@v6
with:
script: |
const issueComment = `
Hello @${context.payload.sender.login}, thank you for raising the issue. Your contribution is greatly appreciated and we look forward to addressing it.
`
github.rest.issues.createComment({
issue_number: context.payload.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: issueComment,
})

- name: Greet for pull request
if: github.event_name == 'pull_request' && github.event.action == 'opened'
uses: actions/github-script@v6
with:
script: |
const prComment = `
Thank you, @${context.payload.sender.login}, for the pull request. We will take a look at it and get back to you shortly.
`
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: prComment,
})