Skip to content

Commit

Permalink
Changed code only to lint yaml files inside the common and example fo…
Browse files Browse the repository at this point in the history
…lder

Signed-off-by: hansinikarunarathne <[email protected]>
  • Loading branch information
hansinikarunarathne committed Jul 1, 2024
1 parent 6456723 commit 3f1bd8d
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/yaml_formatter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,28 @@ jobs:
max: 400
"
- name: Lint YAML files
run: yamllint .
# - name: Lint YAML files
# run: yamllint .

- name: Fetch main branch
run: git fetch origin main

- name: Set up changed files
run: |
git diff --name-only origin/main...HEAD | grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$' > changed_files.txt || true
- name: Display changed files
run: cat changed_files.txt

- name: Run yamllint on changed files
run: |
if [ -s changed_files.txt ]; then
while IFS= read -r file; do
echo "Running yamllint on $file"
yamllint "$file"
done < changed_files.txt
else
echo "No YAML files changed."
fi

0 comments on commit 3f1bd8d

Please sign in to comment.