test
This commit is contained in:
parent
4f5d69546a
commit
cfa832fb67
1 changed files with 16 additions and 14 deletions
|
@ -8,23 +8,25 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Lint YAML files
|
name: Lint YAML files
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: cytopia/yamllint:latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Get modified YAML files
|
||||||
uses: actions/setup-node@v4
|
id: get_changed_files
|
||||||
with:
|
run: |
|
||||||
node-version: 14
|
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E '\.(yml)$' || true)
|
||||||
|
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
|
||||||
- name: Install yamllint
|
|
||||||
run: |
|
|
||||||
npm install -g yaml-lint
|
|
||||||
|
|
||||||
- name: Show yamllint version
|
- name: Run yamllint on modified files
|
||||||
run: |
|
if: env.CHANGED_FILES != ''
|
||||||
yamllint --version
|
run: |
|
||||||
|
yamllint $CHANGED_FILES
|
||||||
|
env:
|
||||||
|
CHANGED_FILES: ${{ env.CHANGED_FILES }}
|
||||||
|
|
||||||
- name: Lint .yml files
|
- name: Skip linting if no YAML files are changed
|
||||||
run: |
|
if: env.CHANGED_FILES == ''
|
||||||
yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" docker/**/*.yml
|
run: echo "No YAML files changed in this PR. Skipping lint."
|
Loading…
Reference in a new issue