Skip to content

Commit

Permalink
Only return a failure exit code when all repos have failed
Browse files Browse the repository at this point in the history
When even one repository fails in a scala steward run the workspace is not persisted by GitHub Actions because GH Actions won't persist the workspace of a failing job. Persisting workspace is crucial for respecting `pullRequests.frequency` configuration because the workspace is how scala steward records that it has opened a pull request. This means that one failing repository can cause a lot of user annoyance because their configuration is no longer respected and they get too many PRs opened.
This change aims to fix that by only returning a failure code if *all* repos have failed.
So long as at least one repository succeeded the exit code will be success and the workspace will persist. If administrators need to know what repos are failing they can use the jobs summary introduced by: scala-steward-org#3071

See more here: guardian/scala-steward-public-repos#60

Co-authored-by: Roberto Tyley <[email protected]>
  • Loading branch information
ioannakok and rtyley committed May 31, 2024
1 parent b94f725 commit 2ef1c08
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.scalasteward.core.data.Repo
case class RunResults(results: List[Either[(Repo, Throwable), Repo]]) {
val (reposWithFailures, successRepos) = results.separate

val exitCode: ExitCode = if (reposWithFailures.isEmpty) ExitCode.Success else ExitCode.Error
val exitCode: ExitCode = if (successRepos.nonEmpty) ExitCode.Success else ExitCode.Error

val markdownSummary: String = {
val failuresSummaryOpt = Option.when(reposWithFailures.nonEmpty) {
Expand Down

0 comments on commit 2ef1c08

Please sign in to comment.