name: "Add Annotations"
description: "Given a file and a way to match line, add annotations to a Github check run"
author: "suo"
inputs:
  check_name:
    description: "The name of the check run to add annotations to.
      This should be the same as the job that uses this action."
    required: true
  linter_output_path:
    description: "Location of file containing lines to regex.
      Generally this file is the output of a linter.
      File location is relative to GITHUB_WORKSPACE."
    required: true
  commit_sha:
    description: "Commit to attach the check to. If the trigger is `push`,
      this should just be github.sha. If the trigger is `pull_request`,
      this should be the tip of the pull request, obtainable by running
      `git rev-parse ${GITHUB_SHA}^2`"
    required: true
  mode:
    description:
    required: "Either 'regex' (in which case the linter_output_path file is read
      line-by-line and the regex input is used) or 'json' (in which case the
      linter_output_path file is expected to be a JSON file containing a single
      array of objects, each of which must have the same keys as the capture
      groups listed in the description of the regex input)."
    default: regex
  regex:
    description: "Regex that will match against each line of the file.
      The following named groups should be captured:
      `filename`, `lineNumber`, `columnNumber`, `errorCode`, `errorDesc`.
      See the default for an example that works for flake8."
    required: true
    default: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorCode>\w\d+) (?<errorDesc>[\s|\w]*)'
runs:
  using: "node12"
  main: "lib/main.js"
