A Github Action to create comments on pull requests with templates, supporting environment variables.
A GitHub action to add a comment on pull requests.
name: Add checkout commands
on: pull_request
jobs:
comment:
name: Add checkout commands
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: harupy/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: template.md
commands to checkout to this branch
```
git fetch upstream pull/{pull_id}/head:{branch_name}
git checkout {branch_name}
```
The template above creates:
- Jason Etcovitch and his create-an-issue Github Action
If you prefer not to download a full action, this can now be easily done thanks to github scripts. (Source: https://github.com/thollander/actions-comment-pull-request)
- name: 'Comment PR'
uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.issues.createComment({ issue_number, owner, repo, body: 'Hello world ! 👋' });