PR feedback
This commit is contained in:
parent
ef92c5ac5f
commit
36a9516acc
3 changed files with 7 additions and 7 deletions
6
lib/actions-util.js
generated
6
lib/actions-util.js
generated
|
|
@ -361,15 +361,15 @@ async function getRef() {
|
|||
// we report back.
|
||||
const pull_ref_regex = /refs\/pull\/(\d+)\/merge/;
|
||||
const head = await exports.getCommitOid("HEAD");
|
||||
// in actions@v2 we can check if git rev-parse HEAD == GITHUB_SHA
|
||||
// in actions@v1 this may not be true as it checks out the repository
|
||||
// in actions/checkout@v2 we can check if git rev-parse HEAD == GITHUB_SHA
|
||||
// in actions/checkout@v1 this may not be true as it checks out the repository
|
||||
// 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;
|
||||
if (pull_ref_regex.test(ref) && hasChangedRef) {
|
||||
const newRef = ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
||||
core.info(`No longer on merge commit, rewriting ref from ${ref} to ${newRef}.`);
|
||||
core.debug(`No longer on merge commit, rewriting ref from ${ref} to ${newRef}.`);
|
||||
return newRef;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -433,8 +433,8 @@ export async function getRef(): Promise<string> {
|
|||
// we report back.
|
||||
const pull_ref_regex = /refs\/pull\/(\d+)\/merge/;
|
||||
const head = await getCommitOid("HEAD");
|
||||
// in actions@v2 we can check if git rev-parse HEAD == GITHUB_SHA
|
||||
// in actions@v1 this may not be true as it checks out the repository
|
||||
// in actions/checkout@v2 we can check if git rev-parse HEAD == GITHUB_SHA
|
||||
// in actions/checkout@v1 this may not be true as it checks out the repository
|
||||
// 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.
|
||||
|
|
@ -442,7 +442,7 @@ export async function getRef(): Promise<string> {
|
|||
|
||||
if (pull_ref_regex.test(ref) && hasChangedRef) {
|
||||
const newRef = ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
||||
core.info(
|
||||
core.debug(
|
||||
`No longer on merge commit, rewriting ref from ${ref} to ${newRef}.`
|
||||
);
|
||||
return newRef;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue