LOLBAS/.github/workflows/yaml-linting.yml

60 lines
2.4 KiB
YAML
Raw Normal View History

2021-03-09 15:06:22 +01:00
---
name: PUSH & PULL REQUEST - YAML Lint and Schema Validation Checks
on: [push,pull_request]
2021-03-09 14:16:42 +01:00
jobs:
2021-03-09 14:28:09 +01:00
lintFiles:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
2021-03-09 15:06:22 +01:00
runs-on: ubuntu-latest
steps:
2022-09-10 22:42:26 +02:00
- uses: actions/checkout@v3
2023-10-03 18:10:21 +02:00
- name: Check file extensions
run: |
files=$(find "$GITHUB_WORKSPACE/yml" -type f -not -name "*.yml");
if [[ $files ]]; then
echo "::error::Files with unexpected extension found, please ensure you use '.yml' (all lower case) for files in the yml/ folder.";
for i in $files; do echo "::error file=$i,line=1::Unexpected extension"; done
exit 1;
fi
unset files
- name: Check duplicate file names
run: |
files=$(find "$GITHUB_WORKSPACE/yml/OSBinaries" "$GITHUB_WORKSPACE/yml/OtherMSBinaries" -type f -printf '%h %f\n' -iname "*.yml" | sort -t ' ' -k 2,2 -f | uniq -i -f 1 --all-repeated=separate | tr ' ' '/')
if [[ $files ]]; then
echo "::error::Files with duplicate filenames detected, please make sure you don't create duplicate entries.";
for i in $files; do echo "::error file=$i,line=1::Duplicate filename"; done
exit 1;
fi
unset files
2022-09-10 23:33:11 +02:00
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
2022-09-10 13:22:41 +02:00
with:
2022-09-11 07:23:21 +02:00
no_warnings: true
file_or_dir: yml/**/*.yml
2022-09-10 23:33:11 +02:00
config_file: .github/.yamllint
- name: Validate Template Schema
uses: cketti/action-pykwalify@v0.3-temp-fix
with:
files: YML-Template.yml
schema: YML-Schema.yml
2022-09-11 06:30:03 +02:00
- name: Validate OSBinaries YAML Schema
uses: cketti/action-pykwalify@v0.3-temp-fix
with:
files: yml/OSBinaries/*.yml
schema: YML-Schema.yml
- name: Validate OSLibraries YAML Schema
uses: cketti/action-pykwalify@v0.3-temp-fix
with:
files: yml/OSLibraries/*.yml
schema: YML-Schema.yml
- name: Validate OSScripts YAML Schema
uses: cketti/action-pykwalify@v0.3-temp-fix
with:
files: yml/OSScripts/*.yml
schema: YML-Schema.yml
- name: Validate OtherMSBinaries YAML Schema
uses: cketti/action-pykwalify@v0.3-temp-fix
with:
files: yml/OtherMSBinaries/*.yml
schema: YML-Schema.yml