Rewrite the ref to correctly point to refs/remotes
Fixes the rev-parse issues caused by https://github.com/github/codeql-action/pull/428
This commit is contained in:
parent
972dc3e3f9
commit
ba14abbca7
6 changed files with 11 additions and 6 deletions
4
lib/actions-util.js
generated
4
lib/actions-util.js
generated
|
|
@ -369,7 +369,9 @@ async function getRef() {
|
|||
// using GITHUB_REF. There is a subtle race condition where
|
||||
// git rev-parse GITHUB_REF != GITHUB_SHA, so we must check
|
||||
// git git-parse GITHUB_REF == git rev-parse HEAD instead.
|
||||
const hasChangedRef = sha !== head && (await exports.getCommitOid(ref)) !== head;
|
||||
const hasChangedRef = sha !== head &&
|
||||
(await exports.getCommitOid(ref.replace(/^refs\/pull\//, "refs/remotes/pull/"))) !==
|
||||
head;
|
||||
if (hasChangedRef) {
|
||||
const newRef = ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
||||
core.debug(`No longer on merge commit, rewriting ref from ${ref} to ${newRef}.`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue