Add this caller to the consumer repository:
name: quality
on: [pull_request, push]
permissions: { contents: read, packages: read }
jobs:
quality:
uses: Runroom/code-quality/.github/workflows/quality.yml@v1The workflow fixes the registry and repository to ghcr.io/runroom/code-quality. The caller controls only these inputs:
| Input | Type | Default | Meaning |
|---|---|---|---|
image-tag |
string | v1 |
Tag pulled from the fixed image repository. |
checks |
string | empty | Lowercase, space-separated logical check IDs; empty runs every detected check. |
setup |
string | empty | Consumer shell command run before checking. |
working-directory |
string | . |
Consumer directory inside /work. |
report |
boolean | false |
Run the advisory report and upload artifacts/quality. |
coverage-artifact |
string | empty | Artifact containing coverage/coverage-final.json for Fallow health. |
The job:
- Checks out the full Git history with
fetch-depth: 0. - Runs the optional setup command in
working-directory. - Validates the shape of the checks input (lowercase letters and spaces) and, when used, the coverage artifact name. Unknown IDs are rejected by the CLI.
- Runs plain
code-quality checkwith the selected IDs. - When
reportis true, optionally downloads coverage, runscode-quality report, and uploadsartifacts/qualityasquality-reportsfor 14 days.
The workflow accepts lowercase check IDs separated by spaces. Coverage artifact names accept letters, digits, ., _, and -.
Knip needs installed node_modules/; the PHP unused-code adapters need vendor/. Use the consumer repository's package manager:
jobs:
quality:
uses: Runroom/code-quality/.github/workflows/quality.yml@v1
with:
setup: pnpm install --frozen-lockfileFor npm, use setup: npm ci. For Composer, use setup: composer install or a suitable non-interactive variant such as setup: composer install --no-interaction.
A complete customized caller can select checks, install PHP dependencies, pin the image major, select a consumer subdirectory, and retain reports:
jobs:
quality:
uses: Runroom/code-quality/.github/workflows/quality.yml@v1
with:
checks: "complexity duplication unused"
setup: composer install --no-interaction
image-tag: v1
working-directory: "."
report: trueWhen tests and reports run in one job, generate coverage/coverage-final.json with the Vitest or Jest JSON reporter and call code-quality report --coverage coverage/coverage-final.json.
When tests run in a separate job, upload the coverage/ directory as an artifact, conventionally named test-coverage. Make the quality job depend on the test job, enable reports, and identify the artifact:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: npm ci
- run: npm test -- --coverage
- uses: actions/upload-artifact@v4
with:
name: test-coverage
path: coverage/
quality:
needs: test
uses: Runroom/code-quality/.github/workflows/quality.yml@v1
with:
report: true
coverage-artifact: test-coverageThe reusable workflow downloads the artifact to coverage/ and passes coverage/coverage-final.json to the report. Raw V8 output is not supported; enable the JSON reporter even when Vitest uses the V8 provider.
Each regression produces a GitHub error annotation. When GITHUB_STEP_SUMMARY is available, code-quality appends its Markdown summary to the job summary.
The reusable workflow never passes --update or --initialize; it runs plain check, so it never writes baselines. The CLI also refuses init, baseline, --update, and --initialize when GITHUB_ACTIONS=true or CI is true, 1, or yes.
Baseline changes require local review and a separate commit. This prevents a CI job from accepting the regressions it is meant to detect.
See Makefile behavior for the generated local targets and Docker recipe.
See Container users for the authoritative behavior of the image, launcher, and GitHub container job.
A pipeline outside GitHub Actions can run the launcher after installing Node 18 or newer and providing Docker:
npx @runroom/code-quality@1 checkThe launcher runs image vX.Y.Z for launcher X.Y.Z and forwards CI, GITHUB_ACTIONS, NO_COLOR, and FORCE_COLOR. When host stdout is a TTY and neither color variable is set, it injects FORCE_COLOR=1 because docker run does not allocate a container TTY. It does not mount a host GITHUB_STEP_SUMMARY file into the container, so use the reusable workflow when GitHub job-summary integration is required.
Without Node, run the image directly:
docker run --rm -v "$PWD:/work" ghcr.io/runroom/code-quality:v1 checkInstall application dependencies before the check when unused-code adapters require them. Treat setup commands and image overrides as trusted code; see Security.