Feat/202604 dataportal #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: YAML Lint | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| # Run only when YAML files are touched in a PR | |
| paths: | |
| - '**/*.yml' | |
| - '**/*.yaml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| yamllint: | |
| name: Lint changed YAML files | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed YAML files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: | | |
| **/*.yml | |
| **/*.yaml | |
| - name: Set up Python | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install yamllint | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: pip install yamllint | |
| - name: Run yamllint on changed files | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: | | |
| echo "Changed YAML files:" | |
| echo "${{ steps.changed-files.outputs.all_changed_files }}" | |
| # Use GitHub annotations-friendly format | |
| yamllint -f github ${{ steps.changed-files.outputs.all_changed_files }} | |
| - name: No YAML file changes detected | |
| if: steps.changed-files.outputs.any_changed != 'true' | |
| run: echo "No YAML files changed in this PR. Skipping lint." |