Skip to content

Commit

Permalink
GH Actions: add Yamllint to validate workflow
Browse files Browse the repository at this point in the history
... to loosely safeguard valid and consistent yaml files and prevent issues like seen in PR 68.

Includes adding a configuration file which loosens up the `default` ruleset to a degree I'm comfortable with.

Ref: https://yamllint.readthedocs.io/
  • Loading branch information
jrfnl committed Nov 11, 2023
1 parent a4eab7e commit e2f862e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ scripts/ export-ignore
.cspell.json export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.yamllint.yml export-ignore
phpcs.xml.dist export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,18 @@ jobs:
diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml")
diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml")
diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml")
yamllint:
name: 'Lint Yaml'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Yamllint on all yaml files in repo
run: yamllint . --format colored --strict

- name: Pipe Yamllint results on to GH for inline display
if: ${{ failure() }}
run: yamllint . --format github --strict
23 changes: 23 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Details on the default config:
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
extends: default

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'
- 'phpstan.neon'

# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html
rules:
colons:
max-spaces-after: -1 # Disabled to allow aligning of values.
comments:
min-spaces-from-content: 1
comments-indentation: {}
document-start:
present: false
line-length:
max: 150
truthy:
allowed-values: ["true", "false", "on", "off"]

0 comments on commit e2f862e

Please sign in to comment.