Repository navigation
chore: lint YAML and GitHub Actions workflows - #122
Draft
iloveitaly wants to merge 6 commits into
Draft
iloveitaly wants to merge 6 commits into
iloveitaly wants to merge 6 commits into
Conversation
Add yamllint and actionlint to the dev toolchain and run them from just dev_lint, which just lint, CI, and the pre-push hook already use. Co-authored-by: Michael Bianco <mike@mikebian.co>
Move the config to .config/yamllint.yml and pass it explicitly so it does not have to live at the repo root. Co-authored-by: Michael Bianco <mike@mikebian.co>
Move the workflow lint config next to yamllint and pass it with -config-file. Co-authored-by: Michael Bianco <mike@mikebian.co>
Lefthook discovers .config/lefthook.yml on its own. commitlint-rs does not, so the hook passes --config. Co-authored-by: Michael Bianco <mike@mikebian.co>
Pass yamllint, actionlint, and commitlint their config paths with long flags. Lefthook has no config flag, so LEFTHOOK_CONFIG points at .config/lint/lefthook.yml. Ignore that directory in Docker and drop the old root config patterns. Co-authored-by: Michael Bianco <mike@mikebian.co>
Drop the dev shell export. lefthook install still receives the path so it can write hooks that source .config/lint/lefthookrc before lefthook run. Co-authored-by: Michael Bianco <mike@mikebian.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
YAML files and GitHub Actions workflows were not part of the lint run. Invalid YAML and workflow mistakes only showed up when Actions executed them.
Description
yamllintandactionlintwith the other dev tools in.config/mise.dev.toml, and lock them so CI installs the same versions (yamllint1.38.0,actionlint1.7.12).just dev_lint.just lintand the Backend CI job already call that recipe. The pre-push hook now runs it too..config/lint/yamllint.ymlkeeps structural checks (duplicate keys, indentation, trailing spaces) and skips rules that fight this repo: a required---document start, an 80-column line limit, and treating the GitHub Actionson:key as a boolean.just dev_lintpasses that file with--config-file. Generatedweb/pnpm-lock.yaml,node_modules/,.venv/,tmp/, andlefthook-local.ymlare ignored.#cloud-configis exempt from the comment-spacing rule because cloud-init requires that exact first line..config/lint/actionlint.ymlallows the deploy job's intentionalif: false.just dev_lintpasses it with--config-file. Shellcheck and pyflakes stay disabled so local runs match CI; GitHub-hosted runners ship shellcheck and this toolchain does not..github/actionlint-matcher.json..config/lint/commitlintrc.ymlso yamllint's empty-lines rule passes. Lefthook has no config flag and only auto-discovers.config/lefthook.yml.just setup --extraspassesLEFTHOOK_CONFIGtolefthook install, which writes git hooks that source.config/lint/lefthookrcbeforelefthook run. The commit-msg hook passescommitlint --config .config/lint/commitlintrc.ymlbecause commitlint-rs only auto-discovers a config in the working directory..dockerignoreignores.config/lintand no longer lists the old root.commitlintrc.ymlorlefthook*.ymlpatterns.lefthook-local.ymlstays ignored because that local override was not moved.Screenshots / Test
just dev_lintexits 0 on the current tree.A duplicate YAML key and a workflow step that sets both
runanduseseach fail the recipe with exit code 1. WithGITHUB_ACTIONS=true, the recipe registers the actionlint problem matcher and still exits 0.Sourcing
.config/lint/lefthookrcand runninglefthook dumpprints the repo hooks. Without that file,lefthook dumpis empty.commitlint --config .config/lint/commitlintrc.yml --print-configprints the repo rules. Without--config, commitlint-rs falls back to its defaults.Links