| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
There's also a potential conflict with #889.
Sorry, something went wrong.
| if (data.startsWith("commit ") && commitOid === "") { | ||
| commitOid = data.substring(7); | ||
| } else if (data.startsWith("parent ")) { | ||
| if (baseOid === "") { | ||
| baseOid = data.substring(7); | ||
| } else if (headOid === "") { | ||
| headOid = data.substring(7); | ||
| } |
There was a problem hiding this comment.
Nice trick to get the merge base.
Sorry, something went wrong.
| @@ -313,15 +314,28 @@ export function buildPayload( | |||
| gitHubVersion.type !== util.GitHubVariant.GHES || | |||
| semver.satisfies(gitHubVersion.version, `>=3.1`) | |||
There was a problem hiding this comment.
Do we need to change the satisfies here? Will GHES < 3.4 accept the new mergeBaseCommitOid parameter?
Sorry, something went wrong.
There was a problem hiding this comment.
There is no new parameter on the dotcom side. This is only about computing a better value for the existing parameter base_sha in some cases. mergeBaseCommitOid is passed into the buildPayload function in this library which then selects it as the base_sha or not.
Sorry, something went wrong.
Sorry, something went wrong.
|
LGTM. It's a shame that it's a little bit complicated to get something as simple as the first parent, especially when it's trivially available on the server side. However, I trust your judgement if you prefer to do it here. I'll leave sign-off to Andrew when he's happy. |
Sorry, something went wrong.
|
I've merged in master and resolved the conflicts by running npm run build. Are we happy with this not having a changelog entry? |
Sorry, something went wrong.
|
I think it's fine if there is no changelog. This is an internal change. However, I thought of something last night as I was falling asleep. The new input to specify the ref and sha for analysis will conflict here semantically. determineMergeBaseCommitOid should return undefined if the ref or sha inputs are defined. |
Sorry, something went wrong.
Hmm, I thought that PR was closed? ... Ah, I see there was a substitute #904 I think I already have the case covered. IMO determineMergeBaseCommitOid should not act differently when these inputs are given. Its purpose is to determine the merge base when we're run in the context of a pull request. We should not use its return value when we're not uploading a result for the merge, but that decision should be made by the upload logic, not determineMergeBaseCommitOid. It is covered here. I think there is a question of what we should declare as base when the upload ref/sha has nothing to do with the context the action is running in. Currently it will still use the previous behaviour of using the PR base. But since that has nothing to do with my change I think it might better be addressed separately. |
Sorry, something went wrong.
|
Thanks for the explanation. I think it all makes sense. What is the danger of using a different merge base? Should we be adding another new input that accepts a merge base if and only if a sha and ref are specified? |
Sorry, something went wrong.
|
Feel free to merge after the conflict has been addressed. |
Sorry, something went wrong.
We're only talking about the case where the action is triggered by the pull_request event. In that case the upload sets the base_ref and base_sha parameters to tell code scanning what the results should best be compared to. Code scanning will only make use of that info if the ref looks like a PR ref, i.e. it is of the form refs/pull/N/merge or refs/pull/N/head to compute and report new and fixed alerts on the PR. This could become a problem if the ref is set to indicate a different PR. Then using the target branch and base sha data of the PR in whose context the action is running is just wrong. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When uploading results for a pull request we tell code scanning against what other commit the results should be compared. So far we've always used the pull request base. However, when we've analyzed the merge of the feature branch and the default branch, it is much more accurate to use the head of the target branch in the comparison.
It was surprisingly difficult to determine the merge base since the default clone in actions is shallow and does not contain the merge's parents. That means the more direct approaches of getting parent data, e.g., git rev-parse HEAD^1, fail. The only way I could find was to do git show --format=raw and then parse the output.
Open question:
Merge / deployment checklist