diff options
| author | Aiqiao Yan <55104035+aiqiaoy@users.noreply.github.com> | 2026-07-15 10:02:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-15 10:02:03 -0400 |
| commit | 76455ef5af5e6c1ef9b1743192c21303bad9dbfc (patch) | |
| tree | e1729018b0ec4f569a16d0d56476b391705cde04 /src/input-helper.ts | |
| parent | c0efd32b49627d541b30e32136690425ed8a86d4 (diff) | |
skip running unsafe pr check if input is default (#2518)
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 ce71cb3..87b2800 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 } |
