Changeset 53591 for trunk/.github/workflows/slack-notifications.yml
- Timestamp:
- 06/30/2022 02:05:29 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/slack-notifications.yml
r53581 r53591 7 7 8 8 on: 9 workflow_run:10 workflows:11 - Code Coverage Report12 - Coding Standards13 - End-to-end Tests14 - JavaScript Tests15 - PHP Compatibility16 - PHPUnit Tests17 - Test NPM18 - Test old branches19 types:20 - completed21 branches:22 - '[3-4].[0-9]'23 - '5.[0-8]'24 25 9 workflow_call: 26 10 inputs: … … 44 28 45 29 env: 46 CURRENT_BRANCH: ${{ github. event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref_name }}30 CURRENT_BRANCH: ${{ github.ref_name }} 47 31 48 32 jobs: … … 70 54 - name: Determine the status of the previous attempt 71 55 id: previous-attempt-result 72 if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}73 56 uses: actions/github-script@7a5c598405937d486b0331594b5da2b14db670da # v6.1.0 74 57 with: … … 92 75 } 93 76 94 let workflow_id = '';95 if ( ${{ github.event_name == 'workflow_run' }} ) {96 workflow_id = '${{ github.event.workflow_run.workflow_id }}';97 } else {98 workflow_id = workflow_run.data.workflow_id;99 }100 101 77 // Otherwise, check the previous workflow run. 102 78 const previous_runs = await github.rest.actions.listWorkflowRuns({ 103 79 owner: context.repo.owner, 104 80 repo: context.repo.repo, 105 workflow_id: workflow_ id,81 workflow_id: workflow_run.data.workflow_id, 106 82 branch: '${{ env.CURRENT_BRANCH }}', 107 83 exclude_pull_requests: true, … … 156 132 run: | 157 133 COMMIT_MESSAGE=$(cat <<'EOF' | awk 'NR==1' | sed 's/`/\\`/g' | sed 's/\"/\\\\\\"/g' | sed 's/\$/\\$/g' 158 ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_commit.message ||( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }}134 ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }} 159 135 EOF 160 136 ) … … 163 139 - name: Construct payload and store as an output 164 140 id: create-payload 165 run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github. event_name == 'workflow_run' && github.event.workflow_run.name || github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"https://github.com/WordPress/wordpress-develop/actions/runs/${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}/attempts/${{ github.event_name == 'workflow_run' && github.event.workflow_run.run_attempt ||github.run_attempt }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"141 run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"https://github.com/WordPress/wordpress-develop/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}" 166 142 167 143 # Posts notifications when a workflow fails. … … 171 147 timeout-minutes: 5 172 148 needs: [ prepare ] 173 if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' ||inputs.calling_status == 'failure' || failure() }}149 if: ${{ inputs.calling_status == 'failure' || failure() }} 174 150 175 151 steps: … … 187 163 timeout-minutes: 5 188 164 needs: [ prepare ] 189 if: ${{ contains( fromJson( '["failure", "cancelled", "none"]' ), needs.prepare.outputs.previous_conclusion ) && ( github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' )&& success() }}165 if: ${{ contains( fromJson( '["failure", "cancelled", "none"]' ), needs.prepare.outputs.previous_conclusion ) && inputs.calling_status == 'success' && success() }} 190 166 191 167 steps: … … 203 179 timeout-minutes: 5 204 180 needs: [ prepare ] 205 if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' ||inputs.calling_status == 'success' && success() }}181 if: ${{ inputs.calling_status == 'success' && success() }} 206 182 207 183 steps: … … 219 195 timeout-minutes: 5 220 196 needs: [ prepare ] 221 if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' ||inputs.calling_status == 'cancelled' || cancelled() }}197 if: ${{ inputs.calling_status == 'cancelled' || cancelled() }} 222 198 223 199 steps:
Note: See TracChangeset
for help on using the changeset viewer.