32 lines
No EOL
889 B
YAML
32 lines
No EOL
889 B
YAML
name: Lint on PR
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint YAML files
|
|
runs-on: docker
|
|
container:
|
|
image: cytopia/yamllint:latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get modified YAML files
|
|
id: get_changed_files
|
|
run: |
|
|
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '\.(yml)$' || true)
|
|
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
|
|
|
|
- name: Run yamllint on modified files
|
|
if: env.CHANGED_FILES != ''
|
|
run: |
|
|
yamllint $CHANGED_FILES
|
|
env:
|
|
CHANGED_FILES: ${{ env.CHANGED_FILES }}
|
|
|
|
- name: Skip linting if no YAML files are changed
|
|
if: env.CHANGED_FILES == ''
|
|
run: echo "No YAML files changed in this PR. Skipping lint." |