Skip to content

Commit

Permalink
Merge pull request #74 from PHPCSStandards/feature/ghactions-add-yaml…
Browse files Browse the repository at this point in the history
…lint

GH Actions: add Yamllint to `validate` workflow
  • Loading branch information
jrfnl authored Nov 11, 2023
2 parents a4eab7e + e2f862e commit b0d171b
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 b0d171b

Please sign in to comment.