Awesome
gitlab-comment
CLI to create GitLab Notes by GitLab REST API
Fork of suzuki-shunsuke/github-comment, supporting GitLab (dropped GitHub support).
Document
Prerequisites
- Create and store GitLab access token in project or group CI variables with key name
GITLAB_TOKEN
orGITLAB_ACCESS_TOKEN
.
ref: Project access tokens | GitLab - When using the post command, a default template is not provided, so you must provide configuration file.
The configuration file name must be one of the following.- .gitlab-comment.yml (or gitlab-comment.yml)
- .gitlab-comment.yaml (or gitlab-comment.yaml)
Basic Comamnds are follows:
# post
github-comment post -k hello
# post: Enable updateCondition
github-comment post -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"${CI_JOB_NAME}"
# exec
github-comment exec -k hello -- echo "this is comment"
# exec: Enable updateCondition
github-comment exec -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"${CI_JOB_NAME}" -- echo "this is comment"
A concrete example of gitlab-comment configuration running on GitLab CI can be found in .gitlab-ci.yml.
And, See also the original documentation (suzuki-shunsuke/github-comment).