From 248a93680bd0b52d315ec13e52f48f2925295add Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 24 Jan 2025 03:49:16 +0000 Subject: [PATCH 1/3] Add yaml lint check for .yaml files --- .github/workflows/ci-file-checks.yaml | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/ci-file-checks.yaml b/.github/workflows/ci-file-checks.yaml index b071257ee..950abd490 100644 --- a/.github/workflows/ci-file-checks.yaml +++ b/.github/workflows/ci-file-checks.yaml @@ -79,6 +79,8 @@ jobs: python_files: ${{steps.filter.outputs.python_files}} cc: ${{steps.filter.outputs.cc}} cc_files: ${{steps.filter.outputs.cc_files}} + yaml: ${{steps.filter.outputs.yaml}} + yaml_files: ${{steps.filter.outputs.yaml_files}} steps: # When invoked manually, use the given SHA to figure out the change list. - if: github.event_name == 'workflow_dispatch' @@ -125,6 +127,9 @@ jobs: - '**/*.cc' - '**/*.h' - '**/*.proto' + yaml: + - added|modified: + - '**/*.yaml' Setup: if: needs.Changes.outputs.python == 'true' @@ -336,3 +341,27 @@ jobs: } >> "$GITHUB_STEP_SUMMARY" fi exit $exit_code + + Yaml-lint: + if: needs.Changes.outputs.yaml == 'true' + name: YAML lint + needs: Changes + runs-on: ubuntu-24.04 + steps: + - name: Check out a copy of the TFQ git repository + uses: actions/checkout@v4 + + - name: Set up yamllint output problem matcher + run: echo '::add-matcher::.github/problem-matchers/yamllint.json' + + - name: Find out the yamllint version + id: yamllint + run: | + version=$(yamllint --version) + echo "version=${version#yamllint }" >> "$GITHUB_OUTPUT" + + - name: Run yamllint ${{steps.yamllint.outputs.version}} + run: | + set -x + # shellcheck disable=SC2086 + yamllint --format github ${{needs.Changes.outputs.yaml_files}} From 1752aa6f78d64779e51eb85dac4d0520cfc6a91f Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 24 Jan 2025 03:51:41 +0000 Subject: [PATCH 2/3] Add problem matcher for yamllint This problem matcher JSON file was originally copied from the [Home Assistant](https://github.com/home-assistant/core) project on GitHub. The Home Assistant project is licensed under the Apache 2.0 open-source license. The version of the files at the time they were copied was 2025.1.2. --- .github/problem-matchers/yamllint.json | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/problem-matchers/yamllint.json diff --git a/.github/problem-matchers/yamllint.json b/.github/problem-matchers/yamllint.json new file mode 100644 index 000000000..ab9449dd7 --- /dev/null +++ b/.github/problem-matchers/yamllint.json @@ -0,0 +1,22 @@ +{ + "problemMatcher": [ + { + "owner": "yamllint", + "pattern": [ + { + "regexp": "^(.*\\.ya?ml)$", + "file": 1 + }, + { + "regexp": "^\\s{2}(\\d+):(\\d+)\\s+(error|warning)\\s+(.*?)\\s+\\((.*)\\)$", + "line": 1, + "column": 2, + "severity": 3, + "message": 4, + "code": 5, + "loop": true + } + ] + } + ] +} From befd669f65083849b8ba4394937f2fe99d9b91b6 Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 24 Jan 2025 03:54:43 +0000 Subject: [PATCH 3/3] Recognize both .yml and .yaml file extensions --- .github/workflows/ci-file-checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-file-checks.yaml b/.github/workflows/ci-file-checks.yaml index 950abd490..3de9a2d48 100644 --- a/.github/workflows/ci-file-checks.yaml +++ b/.github/workflows/ci-file-checks.yaml @@ -130,6 +130,7 @@ jobs: yaml: - added|modified: - '**/*.yaml' + - '**/*.yml' Setup: if: needs.Changes.outputs.python == 'true'