Make WordPress Core

Opened 2 years ago

Closed 20 months ago

#54742 closed defect (bug) (fixed)

Fix GHA on first runs for new branches

Reported by: davidbaumwald's profile davidbaumwald Owned by: desrosj's profile desrosj
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:


When a new branch is created and the GitHub actions triggered, the initial run fails. This is due to the "Get details about the previous workflow run" erroring out because a previous run doesn't yet exist for the new branch.

Props to @desrosj for actually finding and explaining this.

Change History (13)

This ticket was mentioned in Slack in #core by audrasjb. View the logs.

2 years ago

#2 @hellofromTonya
23 months ago

  • Version trunk deleted

Removing trunk as the Version since is known past issue.

This ticket was mentioned in PR #2506 on WordPress/wordpress-develop by desrosj.

20 months ago

  • Keywords has-patch added

#4 @desrosj
20 months ago

  • Milestone changed from Awaiting Review to 6.0

I've attached a fix attempt.

The PR adds a check for the total_count field found in the API response to ensure there is at least one response before attempting to access it.

If there are no previous runs, a default of failure will be used. This will trigger the "fixed" job, which will post to Slack that the workflow is now passing.

#5 @desrosj
20 months ago

  • Keywords commit added

#6 @desrosj
20 months ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 53077:

Build/Test Tools: Prevent error when workflows run for new branches and 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.

#8 @desrosj
20 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Hmm, it appears [53077] did not work as expected:

Reopening to investigate further.

#9 @peterwilsoncc
20 months ago

  • Keywords needs-patch added; has-patch commit removed

Keyword maintenance to keep reports clean.

This ticket was mentioned in PR #2524 on WordPress/wordpress-develop by desrosj.

20 months ago

  • Keywords has-patch added; needs-patch removed

This attempts to simplify how the Slack Notifications workflow checks the previous outcome of a workflow run. Actions now have "run attempts", and this information is returned in a getWorkflowRun() check. This run_attempt number can be used to determine if a previous attempt has been made, and if so, the status can be grabbed.

Trac ticket: [](

#11 @desrosj
20 months ago

In 53108:

Build/Test Tools: Improve the accuracy of “fixed” Slack notifications.

This adjusts the logic of the Slack Notifications workflow to make the “fixed” notifications more reliable.

Currently, the workflow looks at the immediately preceding workflow run for the current branch. This fails to indicate that a workflow is fixed when other unrelated commits are made, and when rerunning the workflow after a false failure (timeout, etc.).

The workflow will now use the following logic to determine if something has been fixed:

  • When a workflow is rerun, the conclusion for the immediately preceding run attempt will now be used to determine if the current attempt has “fixed” the workflow.
  • When on the first run attempt for a workflow run, the workflow conclusion for the immediately preceding commit will be used.
  • When on the first run attempt for a workflow run and no preceding commits for the current branch are present (this is a fresh tag or branch), always consider it “fixed”.

Props davidbaumwald.
See #54742.

#13 @desrosj
20 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

This looks confirmed as fixed, so closing out.

Since the workflow file in trunk is used regardelss of branch, there's no need to backport.

Note: See TracTickets for help on using tickets.