-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixed empty PR branch custom value #216
Conversation
@@ -248,7 +248,7 @@ private void execute() { | |||
addCustomValueAndSearchLink(buildScan, "CI workflow", value)); | |||
envVariable("GITHUB_RUN_ID").ifPresent(value -> | |||
addCustomValueAndSearchLink(buildScan, "CI run", value)); | |||
envVariable("GITHUB_HEAD_REF").ifPresent(value -> | |||
envVariable("GITHUB_HEAD_REF").filter(value -> !value.isEmpty()).ifPresent(value -> |
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.
can we do the filter after the ifPresent
check? since we wouldn't even need the filter if the value isn't present
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.
Sure, however, filter works on the Option<String>
, so if that's empty it won't do anything. Should I still move it? If I move it in the ifPresent
, I'll need to do something like if(!value.isEmpty()) buildScan.value("PR branch", value)
, which I think isn't as nice.
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.
oh i see, in that case does that mean the ifPresent
isn't needed?
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.
It still is, the filter will return empty
if the value doesn't pass the check.
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.
LGTM!
Fixes issue #215.
Scans after the fix:
export GITHUB_HEAD_REF=someBranch
: scanexport GITHUB_HEAD_REF=
: scan