From cfa832fb672f79107cc281afd74d9383616126be Mon Sep 17 00:00:00 2001 From: mafyuh Date: Wed, 11 Dec 2024 00:24:37 -0500 Subject: [PATCH] test --- .forgejo/workflows/yamllint.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.forgejo/workflows/yamllint.yml b/.forgejo/workflows/yamllint.yml index 908ecba..6a33f5d 100644 --- a/.forgejo/workflows/yamllint.yml +++ b/.forgejo/workflows/yamllint.yml @@ -8,23 +8,25 @@ jobs: lint: name: Lint YAML files runs-on: docker + container: + image: cytopia/yamllint:latest steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 14 - - - name: Install yamllint - run: | - npm install -g yaml-lint + - 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: Show yamllint version - run: | - yamllint --version + - name: Run yamllint on modified files + if: env.CHANGED_FILES != '' + run: | + yamllint $CHANGED_FILES + env: + CHANGED_FILES: ${{ env.CHANGED_FILES }} - - name: Lint .yml files - run: | - yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" docker/**/*.yml \ No newline at end of file + - name: Skip linting if no YAML files are changed + if: env.CHANGED_FILES == '' + run: echo "No YAML files changed in this PR. Skipping lint." \ No newline at end of file