Update .forgejo/workflows/yamllint.yml

This commit is contained in:
Matt Reeves 2024-12-12 23:50:46 -05:00
parent e59688cfd4
commit c59f0feb45

View file

@ -1,3 +1,5 @@
name: Lint on PR
on: on:
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
@ -12,26 +14,15 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Fetch all branches - name: Debug Repository Contents
run: git fetch --all
- name: Get modified YAML files
id: get_changed_files
run: | run: |
BASE_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD) pwd
CHANGED_FILES=$(git diff --name-only $BASE_BRANCH HEAD | grep -E '\.(yml)$' || true) ls -R
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
- name: Debug changed files - name: Show yamllint version
run: echo "Changed files: ${{ env.CHANGED_FILES }}" run: |
yamllint --version
- name: Run yamllint on modified files - name: Lint .yml files
if: env.CHANGED_FILES != '' run: |
run: | yamllint -d docker/**/*.yml
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."