Skip to content

Commit 1375173

Browse files
authored
Merge pull request #127 from per1234/release-branch-trigger
Run relevant workflows on release branch creation
2 parents 3639d77 + f359893 commit 1375173

5 files changed

+134
-0
lines changed

.github/workflows/check-general-formatting-task.yml

+26
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Check General Formatting
33

44
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
pull_request:
89
schedule:
@@ -12,7 +13,32 @@ on:
1213
repository_dispatch:
1314

1415
jobs:
16+
run-determination:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
result: ${{ steps.determination.outputs.result }}
20+
steps:
21+
- name: Determine if the rest of the workflow should run
22+
id: determination
23+
run: |
24+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
25+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
26+
if [[
27+
"${{ github.event_name }}" != "create" ||
28+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
29+
]]; then
30+
# Run the other jobs.
31+
RESULT="true"
32+
else
33+
# There is no need to run the other jobs.
34+
RESULT="false"
35+
fi
36+
37+
echo "result=$RESULT" >> $GITHUB_OUTPUT
38+
1539
check:
40+
needs: run-determination
41+
if: needs.run-determination.outputs.result == 'true'
1642
runs-on: ubuntu-latest
1743

1844
steps:

.github/workflows/check-npm-task.yml

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Check npm
33

44
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
paths:
89
- ".github/workflows/check-npm-task.ya?ml"
@@ -27,8 +28,33 @@ permissions:
2728
contents: read
2829

2930
jobs:
31+
run-determination:
32+
runs-on: ubuntu-latest
33+
outputs:
34+
result: ${{ steps.determination.outputs.result }}
35+
steps:
36+
- name: Determine if the rest of the workflow should run
37+
id: determination
38+
run: |
39+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
40+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
41+
if [[
42+
"${{ github.event_name }}" != "create" ||
43+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
44+
]]; then
45+
# Run the other jobs.
46+
RESULT="true"
47+
else
48+
# There is no need to run the other jobs.
49+
RESULT="false"
50+
fi
51+
52+
echo "result=$RESULT" >> $GITHUB_OUTPUT
53+
3054
validate:
3155
name: validate (${{ matrix.project.path }})
56+
needs: run-determination
57+
if: needs.run-determination.outputs.result == 'true'
3258
runs-on: ubuntu-latest
3359

3460
strategy:
@@ -61,6 +87,8 @@ jobs:
6187
6288
check-sync:
6389
name: check-sync (${{ matrix.project.path }})
90+
needs: run-determination
91+
if: needs.run-determination.outputs.result == 'true'
6492
runs-on: ubuntu-latest
6593

6694
strategy:

.github/workflows/check-prettier-formatting-task.yml

+27
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Check Prettier Formatting
33

44
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
paths:
89
- ".github/workflows/check-prettier-formatting-task.ya?ml"
@@ -204,7 +205,33 @@ on:
204205
repository_dispatch:
205206

206207
jobs:
208+
run-determination:
209+
runs-on: ubuntu-latest
210+
permissions: {}
211+
outputs:
212+
result: ${{ steps.determination.outputs.result }}
213+
steps:
214+
- name: Determine if the rest of the workflow should run
215+
id: determination
216+
run: |
217+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
218+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
219+
if [[
220+
"${{ github.event_name }}" != "create" ||
221+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
222+
]]; then
223+
# Run the other jobs.
224+
RESULT="true"
225+
else
226+
# There is no need to run the other jobs.
227+
RESULT="false"
228+
fi
229+
230+
echo "result=$RESULT" >> $GITHUB_OUTPUT
231+
207232
check:
233+
needs: run-determination
234+
if: needs.run-determination.outputs.result == 'true'
208235
runs-on: ubuntu-latest
209236

210237
steps:

.github/workflows/check-taskfiles.yml

+26
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Check Taskfiles
33

44
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
paths:
89
- ".github/workflows/check-taskfiles.ya?ml"
@@ -26,8 +27,33 @@ on:
2627
repository_dispatch:
2728

2829
jobs:
30+
run-determination:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
result: ${{ steps.determination.outputs.result }}
34+
steps:
35+
- name: Determine if the rest of the workflow should run
36+
id: determination
37+
run: |
38+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
39+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
40+
if [[
41+
"${{ github.event_name }}" != "create" ||
42+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
43+
]]; then
44+
# Run the other jobs.
45+
RESULT="true"
46+
else
47+
# There is no need to run the other jobs.
48+
RESULT="false"
49+
fi
50+
51+
echo "result=$RESULT" >> $GITHUB_OUTPUT
52+
2953
validate:
3054
name: Validate ${{ matrix.file }}
55+
needs: run-determination
56+
if: needs.run-determination.outputs.result == 'true'
3157
runs-on: ubuntu-latest
3258

3359
strategy:

.github/workflows/spell-check-task.yml

+27
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ env:
77

88
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
99
on:
10+
create:
1011
push:
1112
pull_request:
1213
schedule:
@@ -16,7 +17,33 @@ on:
1617
repository_dispatch:
1718

1819
jobs:
20+
run-determination:
21+
runs-on: ubuntu-latest
22+
permissions: {}
23+
outputs:
24+
result: ${{ steps.determination.outputs.result }}
25+
steps:
26+
- name: Determine if the rest of the workflow should run
27+
id: determination
28+
run: |
29+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
30+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
31+
if [[
32+
"${{ github.event_name }}" != "create" ||
33+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
34+
]]; then
35+
# Run the other jobs.
36+
RESULT="true"
37+
else
38+
# There is no need to run the other jobs.
39+
RESULT="false"
40+
fi
41+
42+
echo "result=$RESULT" >> $GITHUB_OUTPUT
43+
1944
spellcheck:
45+
needs: run-determination
46+
if: needs.run-determination.outputs.result == 'true'
2047
runs-on: ubuntu-latest
2148

2249
steps:

0 commit comments

Comments
 (0)