skip running unsafe pr check if input is default (#2518)
Some checks failed
Build and Test / test-git-container (push) Failing after 17s
Build and Test / test-proxy (push) Failing after 19s
Build and Test / test-bypass-proxy (push) Failing after 37s
Build and Test / test-output (push) Successful in 22s
Licensed / Check licenses (push) Successful in 52s
Build and Test / test (ubuntu-latest) (push) Failing after 1m8s
Check dist / check-dist (push) Successful in 1m24s
CodeQL / Analyze (javascript) (push) Failing after 2m6s
Build and Test / build (push) Failing after 3m28s
Build and Test / test (macos-latest) (push) Has been cancelled
Build and Test / test (windows-latest) (push) Has been cancelled

This commit is contained in:
Aiqiao Yan
2026-07-15 10:02:03 -04:00
committed by GitHub
parent e8d4307400
commit 62661c4e71
3 changed files with 72 additions and 12 deletions

19
dist/index.js vendored
View File

@@ -42191,12 +42191,19 @@ async function getInputs() {
(getInput('allow-unsafe-pr-checkout') || 'false').toUpperCase() ===
'TRUE';
core_debug(`allow unsafe PR checkout = ${result.allowUnsafePrCheckout}`);
assertSafePrCheckout({
qualifiedRepository,
ref: result.ref,
commit: result.commit,
allowUnsafePrCheckout: result.allowUnsafePrCheckout
});
// The default self-checkout (this repository with no explicit ref) always
// resolves to the trusted ref/commit GitHub set for the triggering event, so
// the fork-checkout guard only needs to run when the caller customized the
// repository or ref.
const isDefaultCheckout = isWorkflowRepository && !getInput('ref');
if (!isDefaultCheckout) {
assertSafePrCheckout({
qualifiedRepository,
ref: result.ref,
commit: result.commit,
allowUnsafePrCheckout: result.allowUnsafePrCheckout
});
}
return result;
}