From 0ffe8e1e007a4f182935cb358df52e095d928da3 Mon Sep 17 00:00:00 2001 From: Ashish Bhatia Date: Sun, 30 Mar 2025 00:58:35 -0700 Subject: [PATCH] ci: add YAML linter --- .github/workflows/lint-yaml.yaml | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/lint-yaml.yaml diff --git a/.github/workflows/lint-yaml.yaml b/.github/workflows/lint-yaml.yaml new file mode 100644 index 0000000..e584409 --- /dev/null +++ b/.github/workflows/lint-yaml.yaml @@ -0,0 +1,63 @@ +# Generated by Gabo (https://github.com/ashishb/gabo) +--- +# Run this locally with act - https://github.com/nektos/act +# act -j lintYaml +name: Lint YAML + +on: # yamllint disable-line rule:truthy + push: + branches: [main, master] + paths: + - '**.yml' + - '**.yaml' + - '.github/workflows/**.yml' + - '.github/workflows/**.yaml' + pull_request: + branches: [main, master] + paths: + - "**.yml" + - "**.yaml" + - ".github/workflows/**.yml" + - ".github/workflows/**.yaml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token +permissions: + contents: read + +jobs: + lintYaml: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Check YAML files with linter + uses: ibiqlik/action-yamllint@v3 + with: + # All files under base dir + file_or_dir: "." + config_data: | + extends: default + yaml-files: + - '*.yaml' + - '*.yml' + rules: + document-start: + level: warning + line-length: + level: warning + new-line-at-end-of-file: + level: warning + trailing-spaces: + level: warning + + - name: Lint GitHub Actions + uses: reviewdog/action-actionlint@v1