Skip to content

A GitHub action to create a comment for a commit on GitHub

License

Notifications You must be signed in to change notification settings

to-s/commit-comment

 
 

Repository files navigation

Commit Comment

GitHub Marketplace

A GitHub action to create a comment for a commit on GitHub.

Commit Comment Example

Usage

      - name: Create commit comment
        uses: peter-evans/commit-comment@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          body: |
            This is a multi-line test comment
            - With GitHub **Markdown**
            - Created by [commit-comment][1]

            [1]: https://github.com/peter-evans/commit-comment

Parameters

  • token (required) - The GitHub authentication token
  • sha - The commit SHA. Defaults to the current commit.
  • body (required) - The contents of the comment.
  • path - Relative path of the file to comment on.
  • position - Line index in the diff to comment on.

Example

Here is an example setting all of the input parameters.

      - name: Create commit comment
        uses: peter-evans/commit-comment@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          sha: 843dea1cc2e721163c20a5c876b5b155f7f3aa75
          body: |
            This is a multi-line test comment
            - With GitHub **Markdown**
            - Created by [commit-comment][1]

            [1]: https://github.com/peter-evans/commit-comment
          path: path/to/file.txt
          position: 1

Evaluating environment variables

Environment variables can be evaluated in the body input as follows.

      - name: Create commit comment
        uses: peter-evans/commit-comment@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          body: |
            My env var: ${process.env.MY_ENV_VAR}

License

MIT

About

A GitHub action to create a comment for a commit on GitHub

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%