Update validate_yamllint.yml

This commit is contained in:
Edward Firmo
2025-03-15 18:23:25 +01:00
committed by GitHub
parent e944cd2c21
commit ace945a4ea

View File

@@ -19,24 +19,29 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@main uses: actions/checkout@v4
with: with:
fetch-depth: '0' fetch-depth: 0 # Ensures full commit history for diff
- name: Identify changed files - name: Identify changed files
uses: tj-actions/changed-files@v41
id: changed-files id: changed-files
with: run: |
files: '**/*.y*ml' BASE=${{ github.event.before }}
separator: "," HEAD=${{ github.sha }}
FILES=$(git diff --name-only $BASE $HEAD -- '**/*.yml' '**/*.yaml' | tr '\n' ',')
echo "changed_files=$FILES" >> $GITHUB_ENV
if [[ -n "$FILES" ]]; then
echo "any_changed=true" >> $GITHUB_ENV
else
echo "any_changed=false" >> $GITHUB_ENV
fi
- name: Validate YAML - name: Validate YAML
if: steps.changed-files.outputs.any_changed == 'true' if: env.any_changed == 'true'
run: | run: |
IFS=',' read -ra FILES <<< "${{ steps.changed-files.outputs.all_changed_files }}" IFS=',' read -ra FILES <<< "${{ env.changed_files }}"
for file in "${FILES[@]}"; do for file in "${FILES[@]}"; do
if [[ "$file" =~ ^*\.yaml$ ]] || \ if [[ "$file" =~ ^.*\.yaml$ ]] || [[ "$file" =~ ^ESPHome/.*\.yaml$ ]]; then
[[ "$file" =~ ^ESPHome/*\.yaml$ ]]; then
echo "Skipping $file" echo "Skipping $file"
continue continue
fi fi