Improve the way to hide comments
Motivation
The feature to hide comments was introduced in v2.1.0,
but we found the specificaiton has some problems.
It is inefficient to get comments and extract hidden comments from them several times.
So in v3, we improve the way to hide comments. This includes breaking changes.
Instead of hiding comments in post
and exec
command, we should call hide
command in the begging of the CI.
Breaking Changes
#210 a HTML comment is embedded to a comment
#210 remove the feature to hide comments in post and exec command
ex.
<!-- github-comment: {"SHA1":"79acc0778da6660712a65fd41a48b72cb7ad16c1","TemplateKey":"default","JobID":"xxx","JobName":"plan"} -->
Features
#205 #210 add a command "hide" and embed meta data to comment
#212 output info logs about comment hidden
#215 feat: get the pull request number from CI_INFO_PR_NUMBER
add a command "hide" and embed meta data to comment
$ github-comment hide
hide config
ex.
---
hide:
plan: 'Comment.HasMeta && (Comment.Meta.SHA1 != Commit.SHA1 || Comment.Meta.Vars.target == "foo")'
$ github-comment hide -k plan
Embeded meta data
- SHA1
- TemplateKey
- Vars
- JobID (optional)
- JobName (optional)
- WorkflowName (optional)
These meta data can be referred in hide condition as Comment.Meta
.
get the pull request number from CI_INFO_PR_NUMBER
The environment variable CI_INFO_PR_NUMBER
is set by ci-info by default.
If the pull request number can't be gotten from platform's built-in environment variables but CI_INFO_PR_NUMBER
is set, github-comment uses CI_INFO_PR_NUMBER
.