Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/input-helper.ts
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>2026-07-15 15:01:36 +0000
committerGitHub <noreply@github.com>2026-07-15 15:01:36 +0000
commita64e9521ce0b82ab465c592a766670b6f21ddda8 (patch)
tree966a26eed274abb83b6ba6fdce8bca7de3a1e58b /src/input-helper.ts
parentced100813c147e2fc3ca692ddc52876ed2358c51 (diff)
skip running unsafe pr check if input is default (backport #2518 to releases/v2)copilot/backport-2518-releases-v2
Diffstat (limited to 'src/input-helper.ts')
-rw-r--r--src/input-helper.ts24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/input-helper.ts b/src/input-helper.ts
index 1a090c7..7bacac6 100644
--- a/src/input-helper.ts
+++ b/src/input-helper.ts
@@ -7,7 +7,7 @@ import * as workflowContextHelper from './workflow-context-helper'
import {IGitSourceSettings} from './git-source-settings'
export async function getInputs(): Promise<IGitSourceSettings> {
- const result = ({} as unknown) as IGitSourceSettings
+ const result = {} as unknown as IGitSourceSettings
// GitHub workspace
let githubWorkspacePath = process.env['GITHUB_WORKSPACE']
@@ -121,7 +121,8 @@ export async function getInputs(): Promise<IGitSourceSettings> {
(core.getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE'
// Workflow organization ID
- result.workflowOrganizationId = await workflowContextHelper.getOrganizationId()
+ result.workflowOrganizationId =
+ await workflowContextHelper.getOrganizationId()
// Set safe.directory in git global config.
result.setSafeDirectory =
@@ -133,12 +134,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
}