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)
| 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). |
| 63 | func 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 | } |
no test coverage detected