Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#54742 closed defect (bug) (fixed)

Fix GHA on first runs for new branches

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

Description

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.


5 years ago

#2 @hellofromTonya
5 years ago

  • Version trunk

Removing trunk as the Version since is known past issue.

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


5 years ago
#3

  • Keywords has-patch added

#4 @desrosj
5 years ago

  • Milestone Awaiting Review → 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
5 years ago

  • Keywords commit added

#6 @desrosj
5 years ago

  • Owner set to desrosj
  • Resolution → fixed
  • Status new → 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
5 years ago

  • Resolution fixed
  • Status closed → reopened

Hmm, it appears [53077] did not work as expected: ​https://github.com/WordPress/wordpress-develop/runs/5839661200?check_suite_focus=true.

Reopening to investigate further.

#9 @peterwilsoncc
5 years 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.


5 years ago
#10

  • 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: [](https://core.trac.wordpress.org/ticket/54742)

#11 @desrosj
5 years 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
5 years ago

  • Resolution → fixed
  • Status reopened → 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.