iac/.forgejo/workflows/yamllint.yml
Workflow config file is invalid. Please check your config file: yaml: line 26: mapping values are not allowed in this context

37 lines
1 KiB
YAML

on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
name: Lint YAML files
runs-on: docker
container:
image: mafyuh/node-yamllint:v1.0.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch all branches
run: git fetch --all
- name: Get modified YAML files
id: get_changed_files
run: |
BASE_BRANCH=$(git rev-parse --abbrev-ref origin/HEAD)
CHANGED_FILES=$(git diff --name-only $BASE_BRANCH HEAD | grep -E '\.(yml)$' || true)
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
- name: Debug changed files
run: echo "Changed files: ${{ env.CHANGED_FILES }}"
- 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."