1
0
mirror of https://github.com/arduino/library-registry.git synced 2025-07-28 02:41:51 +03:00

Add CI workflow to lint YAML files

On every push and pull request that affects relevant files, and periodically, run yamllint to check the YAML files of
the repository for issues.

The .yamllint.yml file is used to configure yamllint:
https://yamllint.readthedocs.io/en/stable/configuration.html
This commit is contained in:
per1234
2021-04-08 21:52:41 -07:00
parent 834af544d0
commit 30aeffc9b0
2 changed files with 151 additions and 0 deletions

78
.github/workflows/check-yaml.yml vendored Normal file
View File

@ -0,0 +1,78 @@
name: Check YAML
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-yaml.yml"
- ".yamllint*"
# Source: https://github.com/ikatyang/linguist-languages/blob/master/data/YAML.json (used by Prettier)
- "**/.clang-format"
- "**/.clang-tidy"
- "**/.gemrc"
- "**/glide.lock"
- "**.yml"
- "**.mir"
- "**.reek"
- "**.rviz"
- "**.sublime-syntax"
- "**.syntax"
- "**.yaml"
- "**.yaml-tmlanguage"
- "**.yaml.sed"
- "**.yml.mysql"
pull_request:
paths:
- ".github/workflows/check-yaml.yml"
- ".yamllint*"
- "**/.clang-format"
- "**/.clang-tidy"
- "**/.gemrc"
- "**/glide.lock"
- "**.yml"
- "**.mir"
- "**.reek"
- "**.rviz"
- "**.sublime-syntax"
- "**.syntax"
- "**.yaml"
- "**.yaml-tmlanguage"
- "**.yaml.sed"
- "**.yml.mysql"
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to yamllint.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:
jobs:
check:
name: ${{ matrix.configuration.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
configuration:
- name: Generate problem matcher output
# yamllint's "github" output type produces annotated diffs, but is not useful to humans reading the log.
format: github
# The other matrix job is used to set the result, so this job is configured to always pass.
continue-on-error: true
- name: Check formatting
# yamllint's "colored" output type is most suitable for humans reading the log.
format: colored
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check YAML
continue-on-error: ${{ matrix.configuration.continue-on-error }}
run: |
yamllint \
--config-file "${{ github.workspace }}/.github/.yamllint.yml" \
--format ${{ matrix.configuration.format }} \
.