Skip to content

Feat/update comment#1

Open
yuyaban wants to merge 3 commits into
mainfrom
feat/update-comment
Open

Feat/update comment#1
yuyaban wants to merge 3 commits into
mainfrom
feat/update-comment

Conversation

@yuyaban
Copy link
Copy Markdown
Owner

@yuyaban yuyaban commented Feb 12, 2023

Description

Two functions have been added.

  • When UpdateCondition is in effect in the post function, a special variable called target is added to the metadata to identify the comment to be updated.
    • When using the same template for several different jobs, the target variable can be used to avoid duplicate comments to be updated.
  • Add UpdateCondition to the exec function as well, similar to post

Test Case

Post

$ HELLO=test1 go run ./cmd/github-comment post --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_A"
$ HELLO=test2 go run ./cmd/github-comment post --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_A"
$ HELLO=test1 go run ./cmd/github-comment post --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_B"

Exec

$ go run ./cmd/github-comment exec --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_A" -- echo "test comment test1" 
$ go run ./cmd/github-comment exec --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_A" -- echo "test comment test2"
$ go run ./cmd/github-comment exec --org yuyaban --repo github-comment --pr 1 -k hello -u 'Comment.HasMeta && Comment.Meta.TemplateKey == "hello"' --var target:"JOB_B" -- echo "test comment test1"

@yuyaban
Copy link
Copy Markdown
Owner Author

yuyaban commented Feb 12, 2023

exit code: 0
stdout: test comment test2

stderr:
combined output: test comment test2

@yuyaban
Copy link
Copy Markdown
Owner Author

yuyaban commented Feb 12, 2023

exit code: 0
stdout: test comment test1

stderr:
combined output: test comment test1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant