post-pr-comment

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 12 Imported by: 0

README

Comment on a GitHub pull request

This GitHub actions adds a comment on a pull request, using provided template and variables to fill it.

Inputs

  • github-token (required): GitHub token to access API to post comment. Usually this is the ${{ github.token }} variable.

    If you limit the default permission scope for the token, make sure to grant pull-requests: write access.

  • template-file (required): path to the template file. Template is processed using Go text/template package, its documentation provides details on supported syntax.

  • variables-file (required): path to the JSON file with the template variables mapping.

Outputs

  • comment-id: integer ID of the comment created.
  • comment-url: full URL pointing to the comment created.

Example usage

steps:
  - uses: actions/checkout@v2
  - uses: artyom/post-pr-comment@v1
    with:
      github-token: ${{ github.token }}
      template-file: template.txt
      variables-file: vars.json
Template example

Template file like this:

Here's your list of {{.name}}:

{{range .items -}}
* {{.}}
{{end}}

And a variable mapping JSON file for this template:

{
 "name": "animals",
 "items": [
  "dog",
  "cat"
 ]
}

Produce such an output:

Here's your list of animals:

* dog
* cat

You can experiment with rendering in the playground: https://play.golang.org/p/TOl7HrQHnVT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL