Skip to content

Commit

Permalink
ENH Don't interrupt processing just cause a branch is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jun 18, 2024
1 parent c426b92 commit 849fbff
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion update_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
global $MODULE_DIR, $GITHUB_REF, $OUT, $PRS_CREATED, $REPOS_WITH_PRS_CREATED;
$OUT = $output;

$reposMissingBranch = [];

// validate system is ready
validate_system();

Expand Down Expand Up @@ -146,8 +148,10 @@
$branchOption
);
}
// If we can't identify an appropriate branch, add to a list so we can report about it later.
if (!in_array($branchToCheckout, $allBranches)) {
error("Could not find branch to checkout for $repo using --branch=$branchOption");
$reposMissingBranch[] = $repo;
continue;
}
}
cmd("git checkout $branchToCheckout", $MODULE_DIR);
Expand Down Expand Up @@ -219,5 +223,13 @@
}
output_repos_with_prs_created();
output_prs_created();

// Report about any repos for which we couldn't find the right branch.
if (count($reposMissingBranch)) {
$reposString = implode("\n- ", $reposMissingBranch);
warning("Could not find branch to checkout for the following repos using --branch=$branchOption:\n- $reposString");
return Command::FAILURE;
}

return Command::SUCCESS;
};

0 comments on commit 849fbff

Please sign in to comment.