Skip to content

gkampitakis/github-action-todo-commenter

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Github Action Todo Commenter

Parses pull request files based on tags and creates a comment with a task list

Usage

name: Todo Comments
on: [pull_request]

jobs:
  todo-comments:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Create Todo Comments
        uses: gkampitakis/github-action-todo-commenter@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          ignore-pattern: '.js$|.snap$'
          review-message: "Please take a look :eyes:"
          # optional, default is "TODO:,FIXME:,BUG:"
          tags: "TODO:,FIXME:,BUG:"

Supports using a regex pattern for ignoring files (e.g. test files) with ignore-pattern and you can add your own tags ( keywords ) in the tags field with a comma separated string.

Example

Example

Note

This action uses the octokit for diffs in a pr.

const { data: diff } = await octokit.rest.pulls.get({
  owner: "octokit",
  repo: "rest.js",
  pull_number: 123,
  mediaType: {
    format: "diff",
  },
});

In some cases the api doesn't return the diff so the action needs to run git diff. So you need to set

- name: Checkout
  uses: actions/checkout@v2
  with:
    fetch-depth: 0

If for some reason you can't set checkout action with this option, the commenter will still work with a warning and all the comments inside the file, matching the tags will be included.


For releasing and versioning the github action https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations.

License MIT