iac/.forgejo/workflows/yamllint.yml

32 lines
815 B
YAML
Raw Normal View History

2024-12-12 23:50:46 -05:00
name: Lint on PR
2024-07-12 23:57:29 -04:00
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
name: Lint YAML files
runs-on: docker
2024-12-11 00:24:37 -05:00
container:
2024-12-11 20:25:08 -05:00
image: mafyuh/node-yamllint:v1.0.0
2024-07-12 23:57:29 -04:00
steps:
- name: Checkout code
uses: actions/checkout@v4
2024-12-12 23:44:09 -05:00
2024-12-12 23:50:46 -05:00
- name: Show yamllint version
run: |
yamllint --version
2024-07-12 23:57:29 -04:00
2024-12-12 23:50:46 -05:00
- name: Lint .yml files
run: |
2024-12-13 00:42:57 -05:00
lint_output=$(find docker -name "*.yml" -exec yamllint --strict -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} \;)
2024-12-13 00:40:01 -05:00
2024-12-13 00:42:57 -05:00
# Check if there are any warnings or errors in the output
echo "$lint_output"
if echo "$lint_output" | grep -q -E "error|warning"; then
echo "YAML linting failed due to errors or warnings."
2024-12-13 00:40:01 -05:00
exit 1
fi