File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
packages/pkl.impl.ghactions Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import "@gha/Context.pkl"
2020import "@gha/Workflow.pkl"
2121
2222import "actions/PublishUnitTestResult.pkl"
23+ import "helpers.pkl"
2324import "jobs/CheckPklEval.pkl"
2425import "util.pkl"
2526
@@ -408,6 +409,7 @@ local withPublishTestResultsForMultipleJobs: Mixin<Workflow.Jobs> = (it) -> (it)
408409 }
409410 ["publish-test-results" ] {
410411 needs = it.keys.filter((key) -> testReports.includes(key)).toListing()
412+ `if` = helpers.ifNoUpstreamFailures
411413 `runs-on` = "ubuntu-latest"
412414 permissions {
413415 checks = "write"
@@ -477,6 +479,8 @@ local function withTriggerWorkflows(triggerType: String): Mixin<Workflow.Jobs> =
477479 }
478480 `runs-on` = "ubuntu-latest"
479481 `if` = "github.repository_owner == 'apple'"
482+ // NOTE: not using helpers.ifNoUpstreamFailures here because nothing should be skipped
483+ // for release, releaseBranch, or main workflows
480484 steps {
481485 new {
482486 name = "Create app token"
Original file line number Diff line number Diff line change @@ -27,3 +27,19 @@ const withMavenPublishSecrets: Mixin<Workflow.Step> = new {
2727 ["ORG_GRADLE_PROJECT_sonatypeUsername" ] = Context.secrets("ORG_GRADLE_PROJECT_SONATYPEUSERNAME" )
2828 }
2929}
30+
31+ /// Use this for an `if` condition on jobs that "fan in" from multiple ancestors when one or more of
32+ /// those ancestors runs conditionally.
33+ ///
34+ /// The four job states in GHA are:
35+ /// * success - completed successfully, checked by `success()`.
36+ /// * failure - ran unsuccessfully, checked by `failure()`.
37+ /// * cancelled - explicit user cancellation, checked by `cancelled()`.
38+ /// * skipped - skipped due to `if` condition, no check function.
39+ ///
40+ /// Per [the docs](https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#status-check-functions):
41+ /// > A default status check of success() is applied unless you include one of these functions.
42+ ///
43+ /// This condition overrides the default behavior to proceed if all ancestor jobs have result
44+ /// `success` or `skipped`.
45+ const ifNoUpstreamFailures : String = "!failure() && !cancelled()"
You can’t perform that action at this time.
0 commit comments