Highlighted button text #107
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: Add Comment to Newly Open PRs | |
on: | |
pull_request_target: | |
types: [opened] | |
branches: | |
- main | |
- develop | |
jobs: | |
add-comment: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Add Comment | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { pull_request } = context.payload; | |
const author = pull_request.user.login; | |
const prNumber = pull_request.number; | |
const comment = `Thank you, @${author}, for creating this pull request and contributing to GitHub-ReadMe! \nOur review team will thoroughly review the pull request and will reach out to you soon! \nPlease make sure you have marked all the completed tasks as done.\nWe appreciate your patience and contribution!`; | |
const { owner, repo } = context.repo; | |
await github.issues.createComment({ | |
owner: owner, | |
repo: repo, | |
issue_number: prNumber, | |
body: comment | |
}); | |
console.log(`Comment added to the PR #${prNumber}.`); |