Repository navigation
ci: add PR linting and secret scanning - #166
Merged
Merged
Conversation
Add a GitHub Actions workflow that runs the project's pre-commit hooks against the files changed in each PR, plus a gitleaks secret scan over the PR's commits. Both block on findings. Enrich the existing .pre-commit-config.yaml with general hygiene checks and four linters (shellcheck, yamllint, actionlint, gitleaks), add a lenient yamllint config tuned for the repo's existing YAML, and add a gitleaks config that keeps the full default ruleset while baselining the repo's pre-existing intentional dummy credentials. Linting is scoped to changed files, so the checks pass on the current tree and only hold new or edited files to standard. - .github/workflows/lint.yml: pull_request workflow, read-only token, two jobs (pre-commit on changed files + gitleaks on the commit range) - .pre-commit-config.yaml: keep existing hooks; add hygiene checks, shellcheck (--severity=warning), yamllint, actionlint, gitleaks - .yamllint.yaml: lenient ruleset - .gitleaks.toml: default rules + allowlist for .env/example placeholders - .gitleaksignore: baseline of pre-existing intentional dummy credentials
Add CONTRIBUTING.md explaining the linting setup and how to mark the repo's intentional dummy credentials so gitleaks does not flag them: inline `# gitleaks:allow` for lint-clean, comment-capable files, and a .gitleaksignore baseline otherwise. Annotate the dummy credentials in four already-lint-clean example files inline, as the preferred convention going forward. - DIUN/docker-compose.yaml - Headscale/Tailscale-Client/docker-compose,yaml - Homepage/Homepage/services.yaml - Kubernetes/Traefik-PiHole/Helm/Traefik/Dashboard/secret-dashboard.yaml
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.
What
Adds CI linting + secret scanning on every pull request, building on the
repo's existing
.pre-commit-config.yaml, and documents the repo'sdummy-credential convention.
.github/workflows/lint.yml— apull_requestworkflow, two jobs:files a PR touches
.pre-commit-config.yaml— keeps the existing hooks; adds hygienechecks + shellcheck, yamllint, actionlint, gitleaks
.yamllint.yaml— lenient yamllint config tuned for this repo.gitleaks.toml/.gitleaksignore— gitleaks config + a baseline ofthe repo's existing intentional dummy credentials
CONTRIBUTING.md— documents the checks and how to handle dummy credsWhy
There's no CI today, and the existing pre-commit hooks aren't enforced on
PRs. This adds a lightweight gate catching common issues (broken scripts,
malformed YAML, invalid workflows) and — addressing #127 — flags secrets
before they land.
Scoped to changed files
Linters run only on the files a PR changes, so CI is green on the current
tree (no upfront cleanup) and new/edited files are held to standard while
the rest is left alone until edited. Because linters read whole files,
editing a legacy file surfaces its pre-existing findings, so a small change
there may come with a little cleanup; strictness is kept low to minimize
this (shellcheck
--severity=warning, lenient yamllint).Dummy credentials
Many tutorials ship intentional throwaway credentials so a config works when
copied — gitleaks can't tell those from a real leak. Two mechanisms
(documented in
CONTRIBUTING.md):# gitleaks:allowon lint-clean, comment-capable files — theconvention for new dummies (4 example files annotated here).
.gitleaksignorebaseline for the rest (JSON, multi-line PEM, fileswith pre-existing lint debt).
Tradeoff:
.gitleaks.tomlallowlists.envand*example*paths (dummy byconvention here), so real secrets must never be placed there.
First pass — more to come
This is a deliberate first pass at CI for the repo; follow-up PRs will expand
coverage. Deferred for now: markdownlint, hadolint, ansible-lint, kubeconform
— each needs per-tool strictness tuning against the existing tree, so they
land as separate PRs.
Fork PRs
Uses the
pull_requesttrigger, so it runs on fork PRs too (read-only token— all the linters need). First-time contributors' PRs need the usual
one-click "Approve and run".