Make WordPress Core

Changeset 53466


Ignore:
Timestamp:
06/05/2022 09:29:53 AM (2 years ago)
Author:
desrosj
Message:

Build/Test Tools: Prevent inaccurate “fixed” notifications in Slack.

When searching for previous workflow runs by branch, GitHub currently includes matches within forks.

If a contributor opens a pull request from their fork with a head_ref matching a Core branch that triggers a workflow on push event, the outcomes of the workflows associated with that pull request are currently used to determine if the previous workflow run had failed.

The result is a false “fixed” notifications when a commit immediately follows a failed workflow run from the pull request.

This adds a check to skip any workflow runs not triggered by a push event to prevent these inaccurate notifications.

Props SergeyBiryukov.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/slack-notifications.yml

    r53427 r53466  
    115115            // Find the workflow run for the commit that immediately preceded this one.
    116116            for ( let i = 0; i < previous_runs.data.workflow_runs.length; i++ ) {
     117              // Protects against false notifications when contributors use similar head_ref names.
     118              if ( previous_runs.data.workflow_runs[ i ].event !== "push" ) {
     119                continue;
     120              }
     121
    117122              if ( previous_runs.data.workflow_runs[ i ].run_number == workflow_run.data.run_number ) {
    118123                return previous_runs.data.workflow_runs[ i + 1 ].conclusion;
Note: See TracChangeset for help on using the changeset viewer.