Skip to content

Commit 4e84635

Browse files
Merge pull request #29 from arduino/sync-check-taskfiles
Sync `check-taskfiles` workflow with its upstream template
2 parents c303fec + a21e769 commit 4e84635

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

.github/workflows/check-taskfiles.yml

Lines changed: 28 additions & 2 deletions
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
paths:
1213
- ".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:
@@ -50,8 +76,8 @@ jobs:
5076
id: download-schema
5177
uses: carlosperate/download-file-action@v2
5278
with:
53-
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
54-
file-url: https://json.schemastore.org/taskfile.json
79+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
80+
file-url: https://taskfile.dev/schema.json
5581
location: ${{ runner.temp }}/taskfile-schema
5682

5783
- name: Install JSON schema validator

0 commit comments

Comments
 (0)