MCPcopy Create free account
hub / github.com/github/gh-aw / buildPRCheckoutCondition

Function buildPRCheckoutCondition

pkg/workflow/safe_outputs_runtime.go:63–75  ·  view source on GitHub ↗

buildPRCheckoutCondition builds the `if:` condition gating the safe_outputs job's checkout and git-configuration steps. The steps should run only when a create_pull_request or push_to_pull_request_branch output will actually be processed, so the condition is the OR of whichever of those two safe out

(safeOutputs *SafeOutputsConfig)

Source from the content-addressed store, hash-verified

61// OR of whichever of those two safe outputs are configured. Callers should only invoke this
62// when at least one of the two is configured (the default branch assumes push_to_pull_request_branch).
63func buildPRCheckoutCondition(safeOutputs *SafeOutputsConfig) ConditionNode {
64 switch {
65 case safeOutputs.CreatePullRequests != nil && safeOutputs.PushToPullRequestBranch != nil:
66 return BuildOr(
67 BuildSafeOutputType("create_pull_request"),
68 BuildSafeOutputType("push_to_pull_request_branch"),
69 )
70 case safeOutputs.CreatePullRequests != nil:
71 return BuildSafeOutputType("create_pull_request")
72 default:
73 return BuildSafeOutputType("push_to_pull_request_branch")
74 }
75}

Callers 1

Calls 2

BuildOrFunction · 0.85
BuildSafeOutputTypeFunction · 0.85

Tested by

no test coverage detected