github suzuki-shunsuke/github-comment v2.1.0-0

latest releases: v6.0.4, v6.0.3, v6.0.3-1...
pre-release3 years ago

Changelog

v2.0.1...v2.1.0-0
milestone

Features

#187 #189 feat: support to hide existing comments
#190 feat: support --log-level option and structured logging with logrus

feat: support to hide existing comments

When github-comment is used at CI, github-comment posts a comment at every builds.
So many same comments would be posted.
Sometimes old comments are noisy, so we want to hide them.

By configuring minimize, we can hide existing comments.
minimize is an expr expression, and comments which match this condition would be hidden.

post:
  foo:
    template: foo
    minimize: Comment.Body contains "foo" # minimize existing comments which includes `foo`
exec:
  foo:
  - when: ExitCode != 0
    template: foo
    minimize: Comment.Body contains "foo" # minimize existing comments which includes `foo`

If minimize isn't set, no comment is hidden.

Wa can use HTML comment to hide comments.

post:
  foo:
    template: |
      {{"<!-- github-comment:foo-" | AvoidHTMLEscape}}{{env "TARGET"}}{{" -->" | AvoidHTMLEscape}}
      foo {{env "TARGET"}}
    minimize: |
      Comment.Body contains "<!-- github-comment:foo-" + Env("TARGET") + " -->"

In case of post command, we can use the following variables in minimize.

  • Commit:
    • Org
    • Repo
    • PRNumber
    • SHA1
  • Comment
    • Body
  • PostedComment:
    • Body
    • TemplateKey
  • Vars

In addition to above variables, we can use the following variables in case of exec command.

  • Command
    • ExitCode
    • Stdout
    • Stderr
    • CombinedOutput
    • Command
    • JoinCommand

Don't miss a new github-comment release

NewReleases is sending notifications on new releases.