diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2026-07-15 14:53:10 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-15 14:53:10 +0000 |
| commit | d49cbd1c78f6bd41a89798bde9b42f0100237a76 (patch) | |
| tree | a87bc098c063a508045ec4fb10f848aa97174be2 /src/input-helper.ts | |
| parent | 5e10bc06cdae3afdf6b3ca935b8a85b820c48464 (diff) | |
skip running unsafe pr check if input is default (backport #2518 to releases/v6)copilot/backport-2518-releases-v6
Diffstat (limited to 'src/input-helper.ts')
| -rw-r--r-- | src/input-helper.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/input-helper.ts b/src/input-helper.ts index 2d20930..e3eb79a 100644 --- a/src/input-helper.ts +++ b/src/input-helper.ts @@ -168,12 +168,19 @@ export async function getInputs(): Promise<IGitSourceSettings> { '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 } |
