Skip to content

Commit c65074e

Browse files
authored
Merge pull request #2 from per1234/validate-action-yml
Add CI workflow to validate action.yml
2 parents 30067ad + 6829272 commit c65074e

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Check Action Metadata
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/check-action-metadata-task.yml"
8+
- "action.yml"
9+
- "Taskfile.yml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/check-action-metadata-task.yml"
13+
- "action.yml"
14+
- "Taskfile.yml"
15+
schedule:
16+
# Run every Tuesday at 8 AM UTC to catch breakage from changes to the JSON schema.
17+
- cron: "0 8 * * TUE"
18+
workflow_dispatch:
19+
repository_dispatch:
20+
21+
jobs:
22+
validate:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
- name: Install Taskfile
30+
uses: arduino/actions/setup-taskfile@master
31+
with:
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
version: 3.x
34+
35+
- name: Validate action.yml
36+
run: task action:validate

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# `arduino/setup-taskfile`
22

33
[![Integration Tests status](https://github.com/arduino/setup-taskfile/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/test-integration.yml)
4+
[![Check Action Metadata status](https://github.com/arduino/setup-taskfile/actions/workflows/check-action-metadata-task.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/check-action-metadata-task.yml)
45
[![Check License status](https://github.com/arduino/setup-taskfile/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/check-license.yml)
56

67
This action makes the `task` binary available to Workflows.

Taskfile.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: "3"
2+
3+
vars:
4+
ACTION_METADATA_SCHEMA_PATH: "$(mktemp -t github-action-schema-XXXXXXXXXX.json)"
5+
6+
tasks:
7+
check:
8+
desc: Check for problems with the project
9+
deps:
10+
- task: action:validate
11+
12+
action:validate:
13+
desc: Validate GitHub Actions metadata against JSON schema
14+
cmds:
15+
- wget --output-document={{ .ACTION_METADATA_SCHEMA_PATH }} https://json.schemastore.org/github-action
16+
- npx ajv-cli validate --strict=false -s {{ .ACTION_METADATA_SCHEMA_PATH }} -d "action.yml"

action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ author: 'Arduino'
44
inputs:
55
version:
66
description: 'Version to use. Example: 3.4.2'
7+
required: false
78
default: '3.x'
89
repo-token:
910
description: "Token with permissions to do repo things"
11+
required: false
1012

1113
runs:
1214
using: 'node12'

0 commit comments

Comments
 (0)