Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13fe018

Browse filesBrowse files
Merge pull request #7 from arduino/check-taskfiles
Add CI workflow to validate Taskfiles
2 parents d716344 + f85e78d commit 13fe018
Copy full SHA for 13fe018

File tree

Expand file treeCollapse file tree

5 files changed

+637
-0
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+637
-0
lines changed

‎.github/workflows/check-taskfiles.yml

Copy file name to clipboard
+101Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
2+
name: Check Taskfiles
3+
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
create:
11+
push:
12+
paths:
13+
- ".github/workflows/check-taskfiles.ya?ml"
14+
- "package.json"
15+
- "package-lock.json"
16+
- "**/Taskfile.ya?ml"
17+
pull_request:
18+
paths:
19+
- ".github/workflows/check-taskfiles.ya?ml"
20+
- "package.json"
21+
- "package-lock.json"
22+
- "**/Taskfile.ya?ml"
23+
schedule:
24+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
25+
- cron: "0 8 * * TUE"
26+
workflow_dispatch:
27+
repository_dispatch:
28+
29+
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+
54+
validate:
55+
name: Validate ${{ matrix.file }}
56+
needs: run-determination
57+
if: needs.run-determination.outputs.result == 'true'
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
62+
strategy:
63+
fail-fast: false
64+
65+
matrix:
66+
file:
67+
# TODO: add paths to any additional Taskfiles here
68+
- ./**/Taskfile.yml
69+
70+
steps:
71+
- name: Checkout repository
72+
uses: actions/checkout@v3
73+
74+
- name: Setup Node.js
75+
uses: actions/setup-node@v3
76+
with:
77+
node-version: ${{ env.NODE_VERSION }}
78+
79+
- name: Download JSON schema for Taskfiles
80+
id: download-schema
81+
uses: carlosperate/download-file-action@v2
82+
with:
83+
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
84+
file-url: https://taskfile.dev/schema.json
85+
location: ${{ runner.temp }}/taskfile-schema
86+
87+
- name: Install JSON schema validator
88+
run: npm install
89+
90+
- name: Validate ${{ matrix.file }}
91+
run: |
92+
# See: https://github.com/ajv-validator/ajv-cli#readme
93+
npx \
94+
--package=ajv-cli \
95+
--package=ajv-formats \
96+
ajv validate \
97+
--all-errors \
98+
--strict=false \
99+
-c ajv-formats \
100+
-s "${{ steps.download-schema.outputs.file-path }}" \
101+
-d "${{ matrix.file }}"

‎.gitignore

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules/

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Check Go status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-task.yml)
77
[![Sync Labels status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/sync-labels.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/sync-labels.yml)
88
[![Check Go Dependencies status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-dependencies-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-go-dependencies-task.yml)
9+
[![Check Taskfiles status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/check-taskfiles.yml)
910

1011
<!--[![Test Go status](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/test-go-task.yml/badge.svg)](https://github.com/arduino/fwuploader-plugin-helper/actions/workflows/test-go-task.yml)-->
1112
<!--[![Codecov](https://codecov.io/gh/arduino/fwuploader-plugin-helper/branch/main/graph/badge.svg)](https://codecov.io/gh/arduino/fwuploader-plugin-helper)-->

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.