Make WordPress Core


Ignore:
Timestamp:
06/05/2022 07:43:50 PM (2 years ago)
Author:
desrosj
Message:

Build/Test Tools: Correctly confirm the previous workflow run was triggered by a push event.

This fixes the code added in [53466] to look at the correct workflow object when determining the outcome of the previous workflow run.

See #55652.

File:
1 edited

Legend:

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

    r53466 r53468  
    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 
    122117              if ( previous_runs.data.workflow_runs[ i ].run_number == workflow_run.data.run_number ) {
    123                 return previous_runs.data.workflow_runs[ i + 1 ].conclusion;
     118                let next_index = i;
     119                do {
     120                  next_index++;
     121
     122                  // Protects against a false notification when contributors use the trunk branch as the pull request head_ref.
     123                  if ( previous_runs.data.workflow_runs[ next_index ].event !== "push" ) {
     124                    continue;
     125                  }
     126
     127                  return previous_runs.data.workflow_runs[ next_index ].conclusion;
     128                } while ( next_index < previous_runs.data.workflow_runs.length );
    124129              }
    125130            }
Note: See TracChangeset for help on using the changeset viewer.