Skip to content

ci: add PR linting and secret scanning - #166

Merged
DefNotJeffrey merged 2 commits into
mainfrom
ci/add-linting
Jul 8, 2026
Merged

DefNotJeffrey merged 2 commits into
mainfrom
ci/add-linting

Conversation

@cyberops7

@cyberops7 cyberops7 commented Jul 1, 2026 •

Copy link
Copy Markdown
Collaborator

What

Adds CI linting + secret scanning on every pull request, building on the
repo's existing .pre-commit-config.yaml, and documents the repo's
dummy-credential convention.

  • .github/workflows/lint.yml — a pull_request workflow, two jobs:
    • pre-commit (changed files): runs the pre-commit hooks on only the
      files a PR touches
    • gitleaks (secret scan): scans the PR's commits for hardcoded secrets
  • .pre-commit-config.yaml — keeps the existing hooks; adds hygiene
    checks + shellcheck, yamllint, actionlint, gitleaks
  • .yamllint.yaml — lenient yamllint config tuned for this repo
  • .gitleaks.toml / .gitleaksignore — gitleaks config + a baseline of
    the repo's existing intentional dummy credentials
  • CONTRIBUTING.md — documents the checks and how to handle dummy creds

Why

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):

  • Inline # gitleaks:allow on lint-clean, comment-capable files — the
    convention for new dummies (4 example files annotated here).
  • .gitleaksignore baseline for the rest (JSON, multi-line PEM, files
    with pre-existing lint debt).

Tradeoff: .gitleaks.toml allowlists .env and *example* paths (dummy by
convention 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_request trigger, 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".

cyberops7 added 2 commits July 5, 2026 14:33
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
@cyberops7
cyberops7 marked this pull request as ready for review July 5, 2026 20:53
Comment thread .github/workflows/lint.yml
@DefNotJeffrey
DefNotJeffrey merged commit af4f572 into main Jul 8, 2026
2 checks passed
@DefNotJeffrey
DefNotJeffrey deleted the ci/add-linting branch July 8, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants