Skip to content

A Github Action to create comments on pull requests with tempates

License

Notifications You must be signed in to change notification settings

Waschnick/comment-on-pr-action

Repository files navigation

comment-on-pr-action

Comment on Pull Request Action

A Github Action to create comments on pull requests with templates, supporting environment variables.

GitHub Actions status Codecov

Comment on PR

A GitHub action to add a comment on pull requests.

Usage Example

.github/workflows/example.yml

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

.github/workflows/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:

comment_example

Special Thanks

DISCLAIMER

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 ! 👋' });

About

A Github Action to create comments on pull requests with tempates

Resources

License

Stars

Watchers

Forks

Packages

No packages published