Waschnick / comment-on-pr-action

A Github Action to create comments on pull requests with tempates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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/github-script@0.3.0
  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

License:Apache License 2.0


Languages

Language:TypeScript 67.1%Language:JavaScript 32.9%