Skip to content
message-square

GitHub Action

comment-pr

v1.2.0 Latest version

comment-pr

message-square

comment-pr

Post a dynamic comment on github PullRequests

Installation

Copy and paste the following snippet into your .yml file.

              

- name: comment-pr

uses: JoseThen/comment-pr@v1.2.0

Learn more about this action in JoseThen/comment-pr

Choose a version

Comment PR

All Contributors

This action can be used to post a dynamic comment on a github PR

Inputs

comment

Optional The comment you would like to post. Default ''.

json

Optional A JSON comment you would like to post. Default ''.

'file_path'

Optional Path to a file containing MarkDown (preffered) syntax with your comment.

GITHUB_TOKEN

Required The value of your GitHub Actions GitHub Token, this is usually: ${{ secrets.GITHUB_TOKEN }}.

Make sure your GITHUB_TOKEN has the proper permissions to write on a pull-request. Check here how to add permissions if necessary.

Permissions example

permissions:
  checks: read
  contents: read
  pull-requests: write

Example usage

uses: JoseThen/comment-pr@v1.2.0
with:
  comment: 'This PR is the bees knees!'
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: JoseThen/comment-pr@v1.2.0
with:
  json: '{ "this": "pr", "is": "the", "bees": "knees"}'
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: JoseThen/comment-pr@v1.2.0
with:
  file_path: './tmp/pr-comment.md'
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Development

  • You need vercel/ncc installed with npm i -g @vercel/ncc before you can compile the logic.

  • To build just make sure npm ci has been run and use ncc build index.js

  • If you don't want to download nodejs and npm you can keep this containerized on the fly with docker run --rm -it -v .:/app node:lts bash and work from the /app dir in the container.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Ciaran Evans
Ciaran Evans

📖
Bruno Henrique da Silva
Bruno Henrique da Silva

📖

This project follows the all-contributors specification. Contributions of any kind welcome!