diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 6f9fc831df92f..68d5de2f0ec3e 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -83,7 +83,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ phpcs, jshint, slack-notifications ] @@ -96,20 +99,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index b397a2241947e..b091727dba4ac 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -90,7 +90,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ e2e-tests, slack-notifications ] @@ -103,19 +106,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index f15d6e4830268..4c4e270a03ea2 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -155,7 +155,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ slack-notifications ] @@ -168,20 +171,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 4ebb1fd17b499..c55e181a15e3e 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -78,7 +78,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ slack-notifications ] @@ -91,20 +94,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/local-docker-environment.yml b/.github/workflows/local-docker-environment.yml index c9dbae312595a..0f322f3bf35f6 100644 --- a/.github/workflows/local-docker-environment.yml +++ b/.github/workflows/local-docker-environment.yml @@ -138,7 +138,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ build-test-matrix, environment-tests-mysql, slack-notifications ] @@ -151,20 +154,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index d9be2c8842ec4..b9d17c4c75bff 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -152,7 +152,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ slack-notifications ] @@ -165,20 +168,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index bd81c8958daa6..c2508f8fd62cb 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -67,7 +67,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ slack-notifications ] @@ -80,20 +83,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index de36d5a505187..f43471e7afab8 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -331,7 +331,10 @@ jobs: failed-workflow: name: Failed workflow tasks - runs-on: ubuntu-24.04 + uses: ./.github/workflows/reusable-failed-workflow.yml + with: + run_id: ${{ github.run_id }} + ref: ${{ github.ref }} permissions: actions: write needs: [ slack-notifications ] @@ -344,20 +347,3 @@ jobs: contains( needs.*.result, 'cancelled' ) || contains( needs.*.result, 'failure' ) ) - - steps: - - name: Dispatch workflow run - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 - with: - retries: 2 - retry-exempt-status-codes: 418 - script: | - github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'failed-workflow.yml', - ref: 'trunk', - inputs: { - run_id: `${context.runId}`, - } - }); diff --git a/.github/workflows/reusable-failed-workflow.yml b/.github/workflows/reusable-failed-workflow.yml new file mode 100644 index 0000000000000..00b027a501433 --- /dev/null +++ b/.github/workflows/reusable-failed-workflow.yml @@ -0,0 +1,34 @@ +name: Failed workflow dispatcher + +on: + workflow_call: + inputs: + run_id: + required: true + type: string + ref: + required: true + type: string + +jobs: + dispatch: + name: Dispatch failed-workflow + runs-on: ubuntu-24.04 + permissions: + actions: write + steps: + - name: Dispatch workflow run + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + with: + retries: 2 + retry-exempt-status-codes: 418 + script: | + github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'failed-workflow.yml', + ref: '${{ inputs.ref }}', + inputs: { + run_id: '${{ inputs.run_id }}', + } + });