CLI to create and hide GitHub comments
MIT License
Bot releases are hidden (Show)
Published by suzuki-shunsuke about 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.1.0...v4.0.0
milestone
#283 No variable becomes embedded in comment by default.
#283 Add the configuration field embeded_var_names
to post and exec config
post:
hello:
template: "Hello {{.Vars.name}}"
embedded_var_names:
- name # Only `.Vars.name` is embedded into the comment
exec:
hello:
- when: true
template: "Hello {{.Vars.name}}"
embedded_var_names:
- name # Only `.Vars.name` is embedded into the comment
embeded_var_names
to post and exec configgithub-comment embedds the metadata into the comment to hide the comment by the metadata.
With github-comment v3, all variables are embedded into the comment, but sometimes this behaviour is undesirable.
With github-comment v4, only variables specified by embedded_var_names
are embedded into the comment.
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.1.0...v4.0.0-0
milestone
#283 No variable becomes embedded in comment by default.
#283 Add the configuration field embeded_var_names
to post and exec config
post:
hello:
template: "Hello {{.Vars.name}}"
embedded_var_names:
- name # Only `.Vars.name` is embedded into the comment
exec:
hello:
- when: true
template: "Hello {{.Vars.name}}"
embedded_var_names:
- name # Only `.Vars.name` is embedded into the comment
embeded_var_names
to post and exec configgithub-comment embedds the metadata into the comment to hide the comment by the metadata.
With github-comment v3, all variables are embedded into the comment, but sometimes this behaviour is undesirable.
With github-comment v4, only variables specified by embedded_var_names
are embedded into the comment.
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.1...v3.1.0
milestone
#134 #237 support to configure complement
#245 add -condition
option to hide command
#246 #247 add vars to complement
#281 #277 add the -var-file option to the post and exec command
#134 #237
Support other platforms with complement
configuration.
complement:
pr:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_PR_NUMBER}'
org:
- type: envsubst
value: 'suzuki-shunsuke'
repo:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_REPO_NAME}'
sha1:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_COMMIT_SHA}'
The following types are supported.
envsubst
: drone/envsubst#EvalEnv
template
: Go's text/template with sprig functions
-condition
option to hide command#245
Support to specify the condition with -condition
option.
$ github-comment hide -condition 'Comment.Body contains "foo"'
#246 #247
complement:
vars:
yoo: # the variable "yoo" is added to "vars"
- type: template
value: '{{env "YOO"}}'
$ github-comment post -var-file content:foo.txt
$ github-comment exec -var-file content:foo.txt -- echo hello
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.1.0-2...v3.1.0-3
milestone
#280 fix: ignore negative pr number
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.1.0-1...v3.1.0-2
milestone
#278 fix: validate negative pr number
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.1.0-0...v3.1.0-1
milestone
#254 fix validation of hide command
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.1...v3.1.0-0
milestone
#134 #237 support to configure complement
#245 add -condition
option to hide command
#246 #247 add vars to complement
#134 #237
Support other platforms with complement
configuration.
complement:
pr:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_PR_NUMBER}'
org:
- type: envsubst
value: 'suzuki-shunsuke'
repo:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_REPO_NAME}'
sha1:
- type: envsubst
value: '${GOOGLE_CLOUD_BUILD_COMMIT_SHA}'
The following types are supported.
envsubst
: drone/envsubst#EvalEnv
template
: Go's text/template with sprig functions
-condition
option to hide command#245
Support to specify the condition with -condition
option.
$ github-comment hide -condition 'Comment.Body contains "foo"'
#246 #247
complement:
vars:
yoo: # the variable "yoo" is added to "vars"
- type: template
value: '{{env "YOO"}}'
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.0...v3.0.1
milestone
#242 fix: Comment.Meta is empty
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.2.0...v3.0.0
milestone
Improve the way to hide comments
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.
#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"} -->
#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
$ github-comment hide
ex.
---
hide:
plan: 'Comment.HasMeta && (Comment.Meta.SHA1 != Commit.SHA1 || Comment.Meta.Vars.target == "foo")'
$ github-comment hide -k plan
These meta data can be referred in hide condition as Comment.Meta
.
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
.
Published by suzuki-shunsuke over 3 years ago
de84d0b build: update version to v3.0.0-4
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.0-2...v3.0.0-3
milestone
#215 feat: 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
.
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.0-1...v3.0.0-2
milestone
#213 #214 validate whether pull request number is set
To hide issue or pull request comments, the pull request or issue number is required.
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v3.0.0-0...v3.0.0-1
milestone
#212 output info logs about comment hidden
#212 fix the parameter of the expression to hide comments
#211 update README
Published by suzuki-shunsuke over 3 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.2.0...v3.0.0-0
milestone
Improve the way to hide comments
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.
#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"} -->
#205 #210 feat: add a command "hide" and embed meta data to comment
$ github-comment hide
ex.
---
hide:
plan: 'Comment.HasMeta && (Comment.Meta.SHA1 != Commit.SHA1 || Comment.Meta.Vars.target == "foo")'
$ github-comment hide -k plan
These meta data can be referred in hide condition as Comment.Meta
.
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.1.0...v2.2.0
milestone
#202 #203 feat: remove color escape sequence
$ github-comment exec -- terraform plan -detailed-exitcode
Of course we know the option -no-color
of terraform plan
.
This is just example.
[0m[1mRefreshing Terraform state in-memory prior to plan...[0m
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
[0m
[0m[1mnull_resource.foo: Refreshing state... [id=3982188145624120504][0m
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
[32m+[0m create
[31m-[0m destroy
[0m
Terraform will perform the following actions:
[1m # null_resource.bar[0m will be created[0m[0m
[0m [32m+[0m[0m resource "null_resource" "bar" {
[32m+[0m [0m[1m[0mid[0m[0m = (known after apply)
}
[1m # null_resource.foo[0m will be [1m[31mdestroyed[0m[0m
[0m [31m-[0m[0m resource "null_resource" "foo" {
[31m-[0m [0m[1m[0mid[0m[0m = "3982188145624120504" [90m->[0m [0m[90mnull[0m[0m
}
[0m[1mPlan:[0m 1 to add, 0 to change, 1 to destroy.[0m
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
null_resource.foo: Refreshing state... [id=3982188145624120504]
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
- destroy
Terraform will perform the following actions:
# null_resource.bar will be created
+ resource "null_resource" "bar" {
+ id = (known after apply)
}
# null_resource.foo will be destroyed
- resource "null_resource" "foo" {
- id = "3982188145624120504" -> null
}
Plan: 1 to add, 0 to change, 1 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.0.1...v2.1.0
milestone
#187 #189 #193 #195 #196 #198 #199 #200 feat: support to hide existing comments
#190 feat: support --log-level
option and structured logging with logrus
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 hide_old_comment
, we can hide old comments.
hide_old_comment
is an expr expression, and comments which match this condition would be hidden.
post:
foo:
template: foo
hide_old_comment: Comment.Body contains "foo" # hide existing comments which includes `foo`
exec:
foo:
- when: ExitCode != 0
template: foo
hide_old_comment: Comment.Body contains "foo" # hide existing comments which includes `foo`
If hide_old_comment
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"}}
hide_old_comment: |
Comment.Body contains "<!-- github-comment:foo-" + Env("TARGET") + " -->"
In case of post
command, we can use the following variables in hide_old_comment
.
In addition to above variables, we can use the following variables in case of exec
command.
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.1.0-4...v2.1.0-5
milestone
#200 fix: rename "minimize" to "hide_old_comment"
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.1.0-3...v2.1.0-4
milestone
#199 fix: ignore error to get an authenticated user
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.1.0-2...v2.1.0-3
milestone
#196 fix: post a comment even if it failed to list hidden comments
#198 fix: don't filter commits by login when login is empty
Published by suzuki-shunsuke almost 4 years ago
https://github.com/suzuki-shunsuke/github-comment/compare/v2.1.0-1...v2.1.0-2
milestone
#195 fix(exec): set template key