Testing new GitHub Action for Welcoming New Contributors #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Welcome New Contributors | |
on: | |
issues: | |
types: [opened] | |
pull_request_target: | |
types: [opened] | |
jobs: | |
welcome: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Welcome Issue | |
if: github.event_name == 'issues' | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const issue = context.issue; | |
const repo = context.repo; | |
const issueAuthor = context.payload.sender.login; | |
const welcomeMessage = ` | |
Hi @${issueAuthor}! :wave: | |
Thank you for opening an issue for Chayn! We appreciate your contribution and will get back to you as soon as possible. Please read the CONTRIBUTING.md file to learn more about contributing to Chayn. Happy coding! | |
`; | |
github.rest.issues.createComment({ | |
...repo, | |
issue_number: issue.number, | |
body: welcomeMessage | |
}); | |
- name: Welcome Pull Request | |
if: github.event_name == 'pull_request_target' | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const pr = context.issue; | |
const repo = context.repo; | |
const prAuthor = context.payload.sender.login; | |
const welcomeMessage = ` | |
Hi @${prAuthor}! :wave: | |
Thank you for submitting a pull request for Chayn! We appreciate your contribution and will review your changes as soon as possible. Please read the CONTRIBUTING.md file to learn more about contributing to Chayn. Happy coding! | |
`; | |
github.rest.issues.createComment({ | |
...repo, | |
issue_number: pr.number, | |
body: welcomeMessage | |
}); |