Skip to content

Commit a4bd95c

Browse files
authored
Merge pull request #33 from arduino/update_workflow
Update `check-taskfile` workflow
2 parents b9618c5 + 03d5684 commit a4bd95c

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

Diff for: .github/workflows/check-taskfiles.yml

+31-2
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,9 +27,37 @@ on:
2627
repository_dispatch:
2728

2829
jobs:
30+
run-determination:
31+
runs-on: ubuntu-latest
32+
permissions: {}
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+
2954
validate:
3055
name: Validate ${{ matrix.file }}
56+
needs: run-determination
57+
if: needs.run-determination.outputs.result == 'true'
3158
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
3261

3362
strategy:
3463
fail-fast: false
@@ -50,8 +79,8 @@ jobs:
5079
id: download-schema
5180
uses: carlosperate/download-file-action@v2
5281
with:
53-
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
54-
file-url: https://json.schemastore.org/taskfile.json
82+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
83+
file-url: https://taskfile.dev/schema.json
5584
location: ${{ runner.temp }}/taskfile-schema
5685

5786
- name: Install JSON schema validator

0 commit comments

Comments
 (0)