Skip to content

Commit

Permalink
Build/Test Tools: Prevent error when workflows run for new branches a…
Browse files Browse the repository at this point in the history
…nd tags.

This fixes a JavaScript error in the Slack notifications workflow. This was causing the first workflow run for each workflow in a new branch or tag to be reported as a failure, even if the important parts of the workflow succeed.

When running a workflow for the first time, a default of `failure` is now used for the previous outcome. This will trigger a success notification to be sent to report successful branching/tagging.

Props davidbaumwald.
Fixes #54742.

git-svn-id: https://develop.svn.wordpress.org/trunk@53077 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Apr 5, 2022
1 parent 3a9abc8 commit 10b258f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ jobs:
per_page: 1,
page: 2,
});
return previous_runs.data.workflow_runs[0].conclusion;
if ( previous_runs.data.total_count > 0 ) {
return previous_runs.data.workflow_runs[0].conclusion;
} else {
// Use failure so all first time runs for a branch or tag are reported to Slack.
return 'failure';
}
- name: Store previous conclusion as an output
id: previous-conclusion
Expand Down

0 comments on commit 10b258f

Please sign in to comment.