# CI reports

> Abstract: Hadolint, zizmor and OSV-Scanner can reuse a report your own CI produced for the reviewed commit, and Assay's Go lint report is imported the same way. The reviewer verifies each report against the source commit, and falls back file by file.

## Why reuse a report

A CI job you control already runs the scanner on every pull request. Reusing its report spares the reviewer a local run.

The reviewer takes a report only when it is tied to the exact commit under review. Anything that does not match, or that the report does not mention, is scanned locally as before.

> A report is evidence from your own pipeline. Configure only producers whose definition and output your team controls. A contributor who can replace the producer could fabricate its findings.

## The defaults

On a requested GitHub or GitLab review, the reviewer first looks for a finished run at the reviewed source commit. These work on both forges with no extra configuration:

| Tool | GitHub workflow | GitHub artifact, or GitLab job | Report file inside it |
|---|---|---|---|
| Hadolint | `hadolint.yml` | `hadolint` | `hadolint.json` |
| zizmor | `zizmor.yml` | `zizmor` | `zizmor.sarif` |
| OSV-Scanner | `osv-scanner.yml` | `osv-scanner` | `osv-scanner.json` |

The GitHub reviewer App needs **Actions: read** to retrieve artifacts. The GitLab reviewer token needs access to the target project's CI jobs and artifacts.

## Point at your own job

To reuse an existing job, add a `scanner_ci` entry to the project, in `REVIEW_PROJECTS` or in `projects.json`. Its keys are the three tools, and each tool takes these settings:

| Setting | GitHub | GitLab |
|---|---|---|
| `producer` | The workflow file name, or its numeric ID | The job name |
| `artifact` | The artifact name. It may contain `{attempt}` for the run's attempt number. | Not used |
| `report` | The report's path inside the artifact | The report's path inside the job's artifacts |
| `all_paths` | Whether a successful run covers every applicable file. Default `false`. | The same |
| `source_root` | The absolute checkout directory, for a custom runner | The same |

**One project's `scanner_ci`, reusing a workflow named `lint.yml`.**

```text
"scanner_ci": {
  "hadolint": {
    "producer": "lint.yml",
    "artifact": "lint-results",
    "report": "reports/hadolint.json",
    "all_paths": true
  }
}
```

Comments:
- Comment 1 (line 3): The workflow that ran Hadolint, by file name.
- Comment 2 (line 4): The artifact its job uploads.
- Comment 3 (line 5): Where the Hadolint JSON sits inside that artifact.
- Comment 4 (line 6): Set only because this workflow checks every changed Dockerfile.


## Tying the report to the commit

The reviewer accepts a report only for the commit it is reviewing.

On GitHub it reads the latest run of the workflow for the source SHA. The run must have completed, with a conclusion of success or failure, and must hold exactly one unexpired artifact of that name.

> A `pull_request` workflow usually checks out a synthetic merge commit, although the API reports the pull request's head. For any workflow other than `push`, check out the source revision, write `git rev-parse HEAD > review-head.txt` in the same checkout as the scanner, and upload that file at the artifact root beside the report. The reviewer compares it with the reviewed SHA. A missing or mismatched stamp sends the file to a local scan.

On GitLab it checks that the merge request's SHA and the head pipeline's SHA are both the reviewed head, and that the named job succeeded or failed on that same commit.

Paths in a report are mapped from the standard checkout directories of each forge. Set `source_root` for a runner that checks out somewhere else.

## Which files a report covers

By default, only the paths a report evidences are taken from it.

An empty Hadolint JSON array, for instance, cannot say which files CI checked. Set `all_paths` to `true` only for a producer that checks **every** applicable changed file, and reports a scanner error as a job failure. A successful report from such a producer covers clean files too. A failed producer supplies only the paths that have findings.

Missing, stale, expired, malformed or incomplete evidence falls back per uncovered file.

> The posted summary says which results came from CI and which ran locally. The JSON report holds all of them under `static_checks`.

## Importing the Go analysis report

Assay's pinned analysis action produces a Go lint report with new and worsened findings. To import it on a requested review, enter the project's trusted Go analysis workflow or job during setup, or add the `go_analysis` field to its project entry.

| Forge | Example setting | What the job must do |
|---|---|---|
| GitHub | `"go_analysis": "go-lint.yml"` | Run the [Assay action](https://github.com/medici-finance/assay/tree/v1.0.94/actions/go-analysis) on the pull request's source head. The reviewer reads the latest run for that SHA, and the artifact `go-analysis-lint-<sha>-<run-id>-<attempt>` of that exact attempt. |
| GitLab | `"go_analysis": "go-lint"` | Run the Assay scanner against the merge request's source head with `GITHUB_REPOSITORY="$CI_PROJECT_PATH"`, and publish the report as `report.json` at the artifact root with `artifacts: {when: always, paths: [report.json]}`. |

The reviewer looks up the report only while handling an authorized `/review`. It accepts a completed scan from a lint job that failed, and checks the repository and the analyzed source SHA before importing the new and worsened findings for changed paths.

- Findings inside the shown hunks join the prompt and its token budget.
- Findings outside them are counted in the summary.
- If CI is still running, or the report is missing, expired, unreadable, invalid or for another head, the summary marks Go analysis as `could not check`, and the rest of the review proceeds.
- A fresh `/review` after CI finishes can pick the report up. Ordinary polls and CI completion never trigger a model call.

> From the command line, `--go-report path/to/report.json` imports a report for the reviewed head. Supply one from a trusted producer. The runner checks the `go-analysis/v1` schema, the source SHA, the coverage count, the totals and the gate before using it.

---

Source of this page: https://pr-agent.assay.guide/ci-reports
