Skip to content

Commit 0b5a591

Browse files
committed
trac-64298: Move the job logic into a reusable workflow
1 parent b60f8ba commit 0b5a591

9 files changed

Lines changed: 42 additions & 143 deletions

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383

8484
failed-workflow:
8585
name: Failed workflow tasks
86-
runs-on: ubuntu-24.04
86+
uses: ./.github/workflows/reusable-failed-workflow.yml
8787
permissions:
8888
actions: write
8989
needs: [ phpcs, jshint, slack-notifications ]
@@ -96,20 +96,3 @@ jobs:
9696
contains( needs.*.result, 'cancelled' ) ||
9797
contains( needs.*.result, 'failure' )
9898
)
99-
100-
steps:
101-
- name: Dispatch workflow run
102-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
103-
with:
104-
retries: 2
105-
retry-exempt-status-codes: 418
106-
script: |
107-
github.rest.actions.createWorkflowDispatch({
108-
owner: context.repo.owner,
109-
repo: context.repo.repo,
110-
workflow_id: 'failed-workflow.yml',
111-
ref: 'trunk',
112-
inputs: {
113-
run_id: `${context.runId}`,
114-
}
115-
});

.github/workflows/end-to-end-tests.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090

9191
failed-workflow:
9292
name: Failed workflow tasks
93-
runs-on: ubuntu-24.04
93+
uses: ./.github/workflows/reusable-failed-workflow.yml
9494
permissions:
9595
actions: write
9696
needs: [ e2e-tests, slack-notifications ]
@@ -103,19 +103,3 @@ jobs:
103103
contains( needs.*.result, 'cancelled' ) ||
104104
contains( needs.*.result, 'failure' )
105105
)
106-
steps:
107-
- name: Dispatch workflow run
108-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
109-
with:
110-
retries: 2
111-
retry-exempt-status-codes: 418
112-
script: |
113-
github.rest.actions.createWorkflowDispatch({
114-
owner: context.repo.owner,
115-
repo: context.repo.repo,
116-
workflow_id: 'failed-workflow.yml',
117-
ref: 'trunk',
118-
inputs: {
119-
run_id: `${context.runId}`,
120-
}
121-
});

.github/workflows/install-testing.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155

156156
failed-workflow:
157157
name: Failed workflow tasks
158-
runs-on: ubuntu-24.04
158+
uses: ./.github/workflows/reusable-failed-workflow.yml
159159
permissions:
160160
actions: write
161161
needs: [ slack-notifications ]
@@ -168,20 +168,3 @@ jobs:
168168
contains( needs.*.result, 'cancelled' ) ||
169169
contains( needs.*.result, 'failure' )
170170
)
171-
172-
steps:
173-
- name: Dispatch workflow run
174-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
175-
with:
176-
retries: 2
177-
retry-exempt-status-codes: 418
178-
script: |
179-
github.rest.actions.createWorkflowDispatch({
180-
owner: context.repo.owner,
181-
repo: context.repo.repo,
182-
workflow_id: 'failed-workflow.yml',
183-
ref: 'trunk',
184-
inputs: {
185-
run_id: `${context.runId}`,
186-
}
187-
});

.github/workflows/javascript-tests.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878

7979
failed-workflow:
8080
name: Failed workflow tasks
81-
runs-on: ubuntu-24.04
81+
uses: ./.github/workflows/reusable-failed-workflow.yml
8282
permissions:
8383
actions: write
8484
needs: [ slack-notifications ]
@@ -91,20 +91,3 @@ jobs:
9191
contains( needs.*.result, 'cancelled' ) ||
9292
contains( needs.*.result, 'failure' )
9393
)
94-
95-
steps:
96-
- name: Dispatch workflow run
97-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
98-
with:
99-
retries: 2
100-
retry-exempt-status-codes: 418
101-
script: |
102-
github.rest.actions.createWorkflowDispatch({
103-
owner: context.repo.owner,
104-
repo: context.repo.repo,
105-
workflow_id: 'failed-workflow.yml',
106-
ref: 'trunk',
107-
inputs: {
108-
run_id: `${context.runId}`,
109-
}
110-
});

.github/workflows/local-docker-environment.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138

139139
failed-workflow:
140140
name: Failed workflow tasks
141-
runs-on: ubuntu-24.04
141+
uses: ./.github/workflows/reusable-failed-workflow.yml
142142
permissions:
143143
actions: write
144144
needs: [ build-test-matrix, environment-tests-mysql, slack-notifications ]
@@ -151,20 +151,3 @@ jobs:
151151
contains( needs.*.result, 'cancelled' ) ||
152152
contains( needs.*.result, 'failure' )
153153
)
154-
155-
steps:
156-
- name: Dispatch workflow run
157-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
158-
with:
159-
retries: 2
160-
retry-exempt-status-codes: 418
161-
script: |
162-
github.rest.actions.createWorkflowDispatch({
163-
owner: context.repo.owner,
164-
repo: context.repo.repo,
165-
workflow_id: 'failed-workflow.yml',
166-
ref: 'trunk',
167-
inputs: {
168-
run_id: `${context.runId}`,
169-
}
170-
});

.github/workflows/performance.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152

153153
failed-workflow:
154154
name: Failed workflow tasks
155-
runs-on: ubuntu-24.04
155+
uses: ./.github/workflows/reusable-failed-workflow.yml
156156
permissions:
157157
actions: write
158158
needs: [ slack-notifications ]
@@ -165,20 +165,3 @@ jobs:
165165
contains( needs.*.result, 'cancelled' ) ||
166166
contains( needs.*.result, 'failure' )
167167
)
168-
169-
steps:
170-
- name: Dispatch workflow run
171-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
172-
with:
173-
retries: 2
174-
retry-exempt-status-codes: 418
175-
script: |
176-
github.rest.actions.createWorkflowDispatch({
177-
owner: context.repo.owner,
178-
repo: context.repo.repo,
179-
workflow_id: 'failed-workflow.yml',
180-
ref: 'trunk',
181-
inputs: {
182-
run_id: `${context.runId}`,
183-
}
184-
});

.github/workflows/php-compatibility.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767

6868
failed-workflow:
6969
name: Failed workflow tasks
70-
runs-on: ubuntu-24.04
70+
uses: ./.github/workflows/reusable-failed-workflow.yml
7171
permissions:
7272
actions: write
7373
needs: [ slack-notifications ]
@@ -80,20 +80,3 @@ jobs:
8080
contains( needs.*.result, 'cancelled' ) ||
8181
contains( needs.*.result, 'failure' )
8282
)
83-
84-
steps:
85-
- name: Dispatch workflow run
86-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
87-
with:
88-
retries: 2
89-
retry-exempt-status-codes: 418
90-
script: |
91-
github.rest.actions.createWorkflowDispatch({
92-
owner: context.repo.owner,
93-
repo: context.repo.repo,
94-
workflow_id: 'failed-workflow.yml',
95-
ref: 'trunk',
96-
inputs: {
97-
run_id: `${context.runId}`,
98-
}
99-
});

.github/workflows/phpunit-tests.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ jobs:
331331

332332
failed-workflow:
333333
name: Failed workflow tasks
334-
runs-on: ubuntu-24.04
334+
uses: ./.github/workflows/reusable-failed-workflow.yml
335335
permissions:
336336
actions: write
337337
needs: [ slack-notifications ]
@@ -344,20 +344,3 @@ jobs:
344344
contains( needs.*.result, 'cancelled' ) ||
345345
contains( needs.*.result, 'failure' )
346346
)
347-
348-
steps:
349-
- name: Dispatch workflow run
350-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
351-
with:
352-
retries: 2
353-
retry-exempt-status-codes: 418
354-
script: |
355-
github.rest.actions.createWorkflowDispatch({
356-
owner: context.repo.owner,
357-
repo: context.repo.repo,
358-
workflow_id: 'failed-workflow.yml',
359-
ref: 'trunk',
360-
inputs: {
361-
run_id: `${context.runId}`,
362-
}
363-
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Failed workflow dispatcher
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
run_id:
7+
required: true
8+
type: string
9+
ref:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
dispatch:
15+
name: Dispatch failed-workflow
16+
runs-on: ubuntu-24.04
17+
permissions:
18+
actions: write
19+
steps:
20+
- name: Dispatch workflow run
21+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
22+
with:
23+
retries: 2
24+
retry-exempt-status-codes: 418
25+
script: |
26+
github.rest.actions.createWorkflowDispatch({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
workflow_id: 'failed-workflow.yml',
30+
ref: '${{ inputs.ref }}',
31+
inputs: {
32+
run_id: '${{ inputs.run_id }}',
33+
}
34+
});

0 commit comments

Comments
 (0)