Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/lint-caller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
# renovate: datasource=github-releases depName=golangci/golangci-lint
# golangci-lint-version: "v2.12.2"
lint-config-dir: config-sync/files
# config-sync/templates holds a root biome.json for other repositories,
# which Biome rejects as a second root config in this one.
lint-biome-exclude: config-sync/templates/*
# This repository has no inline scripts (#537), so it keeps it that way.
lint-inline-scripts-blocking: true

Expand All @@ -46,6 +49,7 @@ jobs:
# renovate: datasource=github-releases depName=jdx/mise
mise-version: "2026.10.19"
lint-config-dir: config-sync/files
lint-biome-exclude: config-sync/templates/* # See the job above.
lint-job-mode: single
lint-inline-scripts-blocking: true
upload-sarif: false
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/lint-include.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ on:
required: false
type: boolean
default: false
lint-biome:
description: "Run Biome (JavaScript, TypeScript, JSON and CSS linting and formatting) when the repository has such
files — uploads SARIF"
required: false
type: boolean
default: false
lint-biome-exclude:
description: "Glob pattern for paths to exclude from Biome (a bash pattern on the repository-relative path; * also
matches /)"
required: false
type: string
default: ""
lint-biome-with-eslint:
description: "Run Biome in repositories that configure ESLint too (eslint.config.* or .eslintrc*), where it steps
aside by default"
required: false
type: boolean
default: false
lint-config-drift:
description: "Check local config files match central DevSecNinja/.github repo"
required: false
Expand All @@ -122,7 +140,7 @@ on:
type: boolean
default: false
upload-sarif:
description: "Upload checkov/trivy/zizmor/ruff results to GitHub code scanning (requires GitHub Advanced Security).
description: "Upload checkov/trivy/zizmor/ruff/biome results to GitHub code scanning (requires GitHub Advanced Security).
Set false for private repos without GHAS to gate on exit codes with console output instead."
required: false
type: boolean
Expand Down Expand Up @@ -171,6 +189,9 @@ jobs:
lint-trivy: ${{ inputs.lint-trivy }}
lint-zizmor: ${{ inputs.lint-zizmor }}
lint-ruff: ${{ inputs.lint-ruff }}
lint-biome: ${{ inputs.lint-biome }}
lint-biome-exclude: ${{ inputs.lint-biome-exclude }}
lint-biome-with-eslint: ${{ inputs.lint-biome-with-eslint }}
lint-config-drift: ${{ inputs.lint-config-drift }}
lint-inline-scripts: ${{ inputs.lint-inline-scripts }}
lint-inline-scripts-blocking: ${{ inputs.lint-inline-scripts-blocking }}
Expand Down
112 changes: 110 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ on:
required: false
type: boolean
default: true
lint-biome:
description: "Run Biome (JavaScript, TypeScript, JSON and CSS linting and formatting) when the repository has such
files — uploads SARIF"
required: false
type: boolean
default: true
lint-biome-exclude:
description: "Glob pattern for paths to exclude from Biome (a bash pattern on the repository-relative path; * also
matches /)"
required: false
type: string
default: ""
lint-biome-with-eslint:
description: "Run Biome in repositories that configure ESLint too (eslint.config.* or .eslintrc*), where it steps
aside by default"
required: false
type: boolean
default: false
lint-config-drift:
description: "Check local config files match central DevSecNinja/.github repo"
required: false
Expand All @@ -117,7 +135,7 @@ on:
type: boolean
default: false
upload-sarif:
description: "Upload checkov/trivy/zizmor/ruff results to GitHub code scanning (requires GitHub Advanced Security).
description: "Upload checkov/trivy/zizmor/ruff/biome results to GitHub code scanning (requires GitHub Advanced Security).
Set false for private repos without GHAS to gate on exit codes with console output instead."
required: false
type: boolean
Expand Down Expand Up @@ -740,6 +758,70 @@ jobs:
sarif_file: ${{ runner.temp }}/ruff.sarif
category: ruff

biome:
name: biome
if: ${{ inputs.lint-biome && (inputs.lint-job-mode == 'parallel' || (inputs.lint-job-mode == 'auto' && !github.event.repository.private))
}}
continue-on-error: ${{ ! inputs.lint-fail-on-error }}
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
security-events: write
steps:
- name: Checkout lint scripts
# The linter scripts ship with this reusable workflow: fetch them from
# the same commit of DevSecNinja/.github that the caller pinned.
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: .devsecninja-lint
sparse-checkout: |-
scripts/lint/
scripts/lint-inline-scripts.py
sparse-checkout-cone-mode: false
persist-credentials: false

- name: Move lint scripts out of the workspace
# Outside the workspace the caller's linters don't scan them, and the
# code checkout doesn't delete them.
run: mv .devsecninja-lint "${RUNNER_TEMP}/devsecninja-lint"

- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Find JavaScript, TypeScript, JSON and CSS files
# Repositories without them skip the mise install and Biome.
id: web-files
env:
STEP_ASIDE_FOR: ${{ !inputs.lint-biome-with-eslint && 'eslint' || '' }}
run: bash "${RUNNER_TEMP}/devsecninja-lint/scripts/lint/detect-language.sh" web
Comment thread
DevSecNinja marked this conversation as resolved.
Resolved

- name: Install mise
if: ${{ steps.web-files.outputs.found == 'true' }}
uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
with:
install: true
version: ${{ inputs.mise-version }}

- name: Run Biome
id: biome
if: ${{ steps.web-files.outputs.found == 'true' }}
env:
UPLOAD_SARIF: ${{ inputs.upload-sarif }}
EXCLUDE_PATTERN: ${{ inputs.lint-biome-exclude }}
run: bash "${RUNNER_TEMP}/devsecninja-lint/scripts/lint/biome.sh"

- name: Upload SARIF report
if: ${{ !cancelled() && steps.biome.outputs.sarif == 'true' }}
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: ${{ runner.temp }}/biome.sarif
category: biome

config-drift:
name: config drift
if: ${{ inputs.lint-config-drift && (inputs.lint-job-mode == 'parallel' || (inputs.lint-job-mode == 'auto' && !github.event.repository.private))
Expand Down Expand Up @@ -870,11 +952,19 @@ jobs:
if: ${{ inputs.lint-ruff }}
run: bash "${RUNNER_TEMP}/devsecninja-lint/scripts/lint/detect-language.sh" python

- name: Find JavaScript, TypeScript, JSON and CSS files
# Repositories without them skip Biome (and its mise install).
id: web-files
if: ${{ inputs.lint-biome }}
env:
STEP_ASIDE_FOR: ${{ !inputs.lint-biome-with-eslint && 'eslint' || '' }}
run: bash "${RUNNER_TEMP}/devsecninja-lint/scripts/lint/detect-language.sh" web

- name: Install mise
if: >-
${{ inputs.lint-dprint || inputs.lint-yamlfmt || inputs.lint-yamllint || inputs.lint-actionlint || inputs.lint-gitleaks
|| inputs.lint-shellcheck || inputs.lint-shfmt || inputs.lint-checkov || inputs.lint-trivy || inputs.lint-zizmor
|| steps.python-files.outputs.found == 'true' }}
|| steps.python-files.outputs.found == 'true' || steps.web-files.outputs.found == 'true' }}
uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
with:
install: true
Expand Down Expand Up @@ -1075,6 +1165,24 @@ jobs:
sarif_file: ${{ runner.temp }}/ruff.sarif
category: ruff

- name: Run Biome
id: biome
if: ${{ steps.web-files.outputs.found == 'true' }}
continue-on-error: true
env:
UPLOAD_SARIF: ${{ inputs.upload-sarif }}
EXCLUDE_PATTERN: ${{ inputs.lint-biome-exclude }}
run: bash "${RUNNER_TEMP}/devsecninja-lint/scripts/lint/biome.sh"

- name: Upload Biome SARIF report
id: biome-sarif
if: ${{ !cancelled() && steps.biome.outputs.sarif == 'true' }}
continue-on-error: true
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
with:
sarif_file: ${{ runner.temp }}/biome.sarif
category: biome

- name: Check config drift against central repo
id: config-drift
if: ${{ inputs.lint-config-drift }}
Expand Down
1 change: 1 addition & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ min_version = "2026.10.19"

[tools]
actionlint = "1.7.12"
biome = "2.6.8"
cocogitto = "7.0.0"
dprint = "0.64.3"
gitleaks = "8.30.1"
Expand Down
2 changes: 2 additions & 0 deletions .renovate/customManagers.json5
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
$schema: "https://docs.renovatebot.com/renovate-schema.json",
// Keeps the $schema version of biome.json(c) in step with Biome updates.
extends: ["customManagers:biomeVersions"],
customManagers: [
{
customType: "regex",
Expand Down
40 changes: 40 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": [
"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,json,jsonc,css}",
"!**/node_modules",
"!apm_modules",
"!.agents",
"!.claude",
"!.cursor",
"!.gemini",
"!.github/agents",
"!.github/chatmodes",
"!.github/instructions",
"!.github/prompts",
"!.github/skills",
"!.kiro",
"!.opencode",
"!.specify",
"!.venv*",
"!.windsurf",
"!!config-sync/templates"
]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"linter": {
"rules": {
"preset": "recommended"
}
}
}
4 changes: 1 addition & 3 deletions config-sync/files/dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@
".specify/**",
".venv*/**"
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.21.1.wasm"
]
"plugins": ["https://plugins.dprint.dev/markdown-0.21.1.wasm"]
}
1 change: 1 addition & 0 deletions config-sync/templates/.mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ min_version = "2026.10.19"

[tools]
actionlint = "1.7.12"
biome = "2.6.8"
dprint = "0.64.3"
gitleaks = "8.30.1"
lefthook = "2.2.2"
Expand Down
14 changes: 14 additions & 0 deletions config-sync/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,17 @@ same generated and vendored paths as the shared `dprint.json`. Config-sync
doesn't add it to a repo that configures ruff in `.ruff.toml` or in
`[tool.ruff]` of `pyproject.toml`, where `ruff.toml` would take precedence and
replace those settings.

## biome.json

Config for Biome, which the shared Lint workflow runs when the repo has
JavaScript, TypeScript, JSON or CSS files (`lint-biome`). It limits Biome to
those files, leaving Markdown and YAML to dprint and yamlfmt, indents with two
spaces, wraps at 120 columns, enables the recommended lint rules, respects
`.gitignore` and skips the same generated and vendored paths as the shared
`dprint.json`. Biome's other defaults (double quotes, semicolons) apply; change
them in the repo's copy. JSON allows no comments, so this note replaces the
usual template header. Config-sync doesn't add it to a repo that has
`biome.jsonc`. The `customManagers:biomeVersions` Renovate preset, part of the
shared Renovate config, keeps its `$schema` version in step with the pinned
Biome.
39 changes: 39 additions & 0 deletions config-sync/templates/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": [
"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,json,jsonc,css}",
"!**/node_modules",
"!apm_modules",
"!.agents",
"!.claude",
"!.cursor",
"!.gemini",
"!.github/agents",
"!.github/chatmodes",
"!.github/instructions",
"!.github/prompts",
"!.github/skills",
"!.kiro",
"!.opencode",
"!.specify",
"!.venv*",
"!.windsurf"
]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"linter": {
"rules": {
"preset": "recommended"
}
}
}
21 changes: 19 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ workflow, so it calls `scripts/apm-materialize/` from its own checkout.

### Lint (`lint.yml`)

Runs up to fourteen linters. By default, linter failures are reported without
Runs up to fifteen linters. By default, linter failures are reported without
failing the workflow; set `lint-fail-on-error` to `true` to make lint failures
fail the workflow. Toggle individual linters on/off with boolean inputs; all
linter toggles default to `true`.
Expand Down Expand Up @@ -187,6 +187,20 @@ APM-deployed agent files, `node_modules`, `.venv*`).
[`ruff.toml` template](../config-sync/templates/ruff.toml) is a starting
point. Findings are annotated on the PR, and with `upload-sarif` they also go
to code scanning (category `ruff`).
- **Biome** (`lint-biome`, JavaScript, TypeScript, JSON and CSS, after v4.5.0)
runs `biome ci`, which lints and checks formatting and import order without
writing, on the `*.js`, `*.mjs`, `*.cjs`, `*.jsx`, `*.ts`, `*.mts`, `*.cts`,
`*.tsx`, `*.json`, `*.jsonc` and `*.css` files. Biome runs once `biome` 2.4.0 or
later is pinned in the repository's mise config; until then it warns how to opt
in and skips. Biome reads the repository's own `biome.json` or
`biome.jsonc`; config-sync's
[`biome.json` template](../config-sync/templates/biome.json) is a starting
point. Findings are annotated on the PR, and with `upload-sarif` they also go
to code scanning (category `biome`). `lint-biome-exclude` skips more paths,
such as a directory with another root Biome config, which Biome rejects.
Biome steps aside in repositories that configure ESLint (`eslint.config.*`,
`.eslintrc*`), which lint in their own CI with their plugins; set
`lint-biome-with-eslint` to run both. dprint formats only Markdown.

**Inline scripts.** Code in a `run:` block is out of reach of linters,
formatters and tests, so a `run:` step may hold exactly one line with one
Expand Down Expand Up @@ -229,7 +243,7 @@ runner's system Python, which ships PyYAML (`ubuntu-24.04`).
| `lint-config-dir` | Optional linter config directory. Default: `""`. |
| `lint-fail-on-error` | Fail when a linter fails. Default: `false`. |
| `lint-job-mode` | `auto`, `single`, or `parallel` (see above). Default: `auto`. v3.3.0+. |
| `upload-sarif` | Upload SARIF (checkov, trivy, zizmor, ruff). Default: `true`. |
| `upload-sarif` | Upload SARIF (checkov, trivy, zizmor, ruff, biome). Default: `true`. |
| `lint-dprint` | Markdown formatting (dprint). Default: `true`. |
| `lint-yamlfmt` | YAML formatting (yamlfmt). Default: `true`. |
| `lint-yamllint` | YAML linting (yamllint). Default: `true`. |
Expand All @@ -242,6 +256,9 @@ runner's system Python, which ships PyYAML (`ubuntu-24.04`).
| `lint-trivy` | Filesystem scan (trivy). Default: `true`. |
| `lint-zizmor` | Actions security scan (zizmor). Default: `true`. |
| `lint-ruff` | Python linting (ruff, see above). Default: `true`. After v4.5.0. |
| `lint-biome` | JS/TS/JSON/CSS linting (Biome). Default: `true`. After v4.5.0. |
| `lint-biome-exclude` | Bash pattern of paths Biome skips. Default: `""`. After v4.5.0. |
| `lint-biome-with-eslint` | Run Biome next to ESLint. Default: `false`. After v4.5.0. |
| `lint-config-drift` | Config-drift check. Default: `false`. |
| `lint-inline-scripts` | Inline-script check (see above). Default: `true`. After v4.4.0. |
| `lint-inline-scripts-blocking` | Report inline scripts as errors. Default: `false`. After v4.4.0. |
Expand Down
Loading
Loading