diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2026-07-15 14:59:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-15 14:59:45 +0000 |
| commit | 4c75eef541337838823ca1a6b18bde2131c6a191 (patch) | |
| tree | fe8df2c8238fa4237eaf50001ed83bec34c24a18 /dist | |
| parent | 90723f5985926a25e7ccfe67fdcc242120503361 (diff) | |
skip running unsafe pr check if input is default (backport #2518 to releases/v3)copilot/backport-2518-releases-v3
Diffstat (limited to 'dist')
| -rw-r--r-- | dist/index.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dist/index.js b/dist/index.js index e7b1c75..f3e19ee 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1779,12 +1779,19 @@ function getInputs() { (core.getInput('allow-unsafe-pr-checkout') || 'false').toUpperCase() === 'TRUE'; core.debug(`allow unsafe PR checkout = ${result.allowUnsafePrCheckout}`); - unsafePrCheckoutHelper.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 && !core.getInput('ref'); + if (!isDefaultCheckout) { + unsafePrCheckoutHelper.assertSafePrCheckout({ + qualifiedRepository, + ref: result.ref, + commit: result.commit, + allowUnsafePrCheckout: result.allowUnsafePrCheckout + }); + } return result; }); } |
