From 8063ceda3277306c1de4d7d6b8d25d70fa2faea1 Mon Sep 17 00:00:00 2001 From: dtor Date: Fri, 15 Nov 2024 12:38:20 +0000 Subject: [PATCH] fix: wrong yamllint skip Fixes by splitting the string and iterating over it --- .github/workflows/yamllint.yml | 10 +++++++++- examples/cpp/BUILD | 2 +- examples/cpp/hello.cpp | 4 +++- examples/cpp/hello.hpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml index 9eb8eecb..a61c89e4 100644 --- a/.github/workflows/yamllint.yml +++ b/.github/workflows/yamllint.yml @@ -22,7 +22,15 @@ jobs: pip install yamllint - name: Lint YAML files run: |- - if echo "${{ steps.changed_files.outputs.all }}" | grep -qE '\.(yml|yaml)$'; then + IFS=' ' read -r -a files <<< "${{ steps.changed_files.outputs.all }}" + yaml_files=() + for file in "${files[@]}"; do + if [[ "$file" == *.yaml || "$file" == *.yml ]]; then + yaml_files+=("$file") + fi + done + + if [ ${#yaml_files[@]} -gt 0 ]; then echo -e "Running yamllint" yamllint . || exit 1 else diff --git a/examples/cpp/BUILD b/examples/cpp/BUILD index 8cdddc99..1240e388 100644 --- a/examples/cpp/BUILD +++ b/examples/cpp/BUILD @@ -16,8 +16,8 @@ cc_test( name = "test", srcs = ["test.cpp"], deps = [ - ":lib", "@googletest//:gtest", "@googletest//:gtest_main", + ":lib", ], ) diff --git a/examples/cpp/hello.cpp b/examples/cpp/hello.cpp index cb52b412..76370c0a 100644 --- a/examples/cpp/hello.cpp +++ b/examples/cpp/hello.cpp @@ -2,6 +2,8 @@ #include -auto greet() -> std::string { return "Hello World!"; } +std::string greet( ){ + return "Hello World!"; +} auto farewell() -> std::string { return "Bye World!"; } diff --git a/examples/cpp/hello.hpp b/examples/cpp/hello.hpp index bf1e2e70..166a2039 100644 --- a/examples/cpp/hello.hpp +++ b/examples/cpp/hello.hpp @@ -1,4 +1,4 @@ #include -auto greet() -> std::string; +std::string greet(); auto farewell() -> std::string;