-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add comment target flag and parsing #1241
Conversation
Add warn method. Rename commit comment methods with 'commit' prefix.
3851bb2
to
5b1deb4
Compare
The flag is replaced with --target=issue#<id>.
--target=auto will create PR comments if the comment is run in an action with a PR context or if the HEAD commit is associated with a PR. Otherwise a commit comment will be created.
This portion is to just add the |
This adds support for all target types
…On Thu, Nov 3, 2022, 21:05 Daniel Barnes ***@***.***> wrote:
This portion is to just add the --target=commit type functionality? and
not --target=issue#1234 type correct?
—
Reply to this email directly, view it on GitHub
<#1241 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA5DNERMJLHB3FSYUSXSWLWGQEJHANCNFSM6AAAAAARRDJ6XQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a --target=issue#1234
creates commit comment. see: https://github.com/iterative/cml-playground/actions/runs/3388499291/jobs/5630555691#step:5:11
Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One significant change in this PR is that bitbucket commit comments will no longer be automatically posted at the PR level.
Why? It goes against the current CML definition (the video is even showing it as the rest of forges)
Because this behavior is inconsistent across forges. We don't do the same thing for github, where the support for commit comments is similar to bitbucket's. In addition to this, the side effect of the current implementation is that the PR comments are augmented with a link to the commit on all forges, which imho is unnecessary. |
This comment was marked as resolved.
This comment was marked as resolved.
type: 'string', | ||
description: | ||
'Forge object to create comment on, can be one of pr, commit or issue. ' + | ||
"Specify 'issue#123' to create a comment on a specific issue. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what syntaxes are supported?
123
#123
issue#123
pr#123
mr#123
- URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid targets are:
auto
determine comment target automatically:- PR if running in a PR context
- PR if HEAD commit is part of a PR
- HEAD commit (fallback)
pr
- determine pr by context or head commit (making allowances for how github's PR merge commits)pr#123
- specific PR numbercommit
- current HEAD commitcommit#adfa12
- specific commitissue#123
- specific issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need:
#123
to auto-infer pr-or-issuemr
alias forpr
mr#123
alias forpr#123
why do we havecommit#d34db3
? Doesn't--commit-sha=d34db3
already cover this?full URL (e.g. if they want to target another PR returned bycml pr
)
moved to #1228 (review)
Can we close this change request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 great effort!
I do not get the warn
method.
It should be at most a CML capability and to be honest not even that. We already have a logging mechanism in place.
Its also missing in GH?
Probably I missing something 🙏
The |
But its doing at the end a console.log so could winston handle it? |
Yes, except for GitHub, see my review suggestions above |
Resolved with cacae963b9bbfe748f2c128896452a2aa32f04beb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final testing to be done in the feature branch
* Allow creation of issue comments in cml (#1202) * Driver support for issue comments. * Create or update issue comments. * Add e2e issue comment creation tests for github and bitbucket drivers. * Add gitlab issue comment e2e test. * Add comment target flag and parsing (#1241) * Add target cli option. * Add comment target parsing. * Add debug logging in comment target parsing. Co-authored-by: DavidGOrtega <[email protected]> Co-authored-by: Casper da Costa-Luis <[email protected]>
One significant change in this PR is that bitbucket commit comments will no longer be automatically posted at the PR level.
The
--target=auto
scenario is not yet being handled in this PR, this will be implemented in a follow-up.The general idea is as follows:
--pr
,--commitSha
) take precendence.--issue
flag will be removed in a follow-up (replaced with--target=issue#id
)--target
flag can take both qualified (--target=pr#id
or--target=commit#sha
or--target=issue#id
) and unqualified values (--target=pr
or--target=commit
)pr
target, cml will first attempt to determine the PR number using the forge context (env vars for bitbucket and gitlab,context.pull_request.number
for github) - if that fails, an attempt will be made to determine the pr number using the sha of the head commitcommit
target, comments will be attached to the head commit