loadwise check, prints annotations on the pull request and uploads SARIF to code scanning.
For
changed-only, a pull request uses its base SHA, a push uses its before SHA, and a merge queue run uses the merge_group base SHA. Set base-sha to override the event, including for other triggers. Use actions/checkout with fetch-depth: 0 and make sure it has the base commit. If the base is missing, all zeros, invalid, or cannot be compared with HEAD, the action warns and runs a full source scan.
An event-derived push base must be an ancestor of HEAD. Rollbacks and divergent force pushes fall back to a full source scan since a common ancestor can omit files reintroduced by the push. If you pass the previous tip as base-sha for such a push, the comparison starts at its common ancestor with HEAD.
When Reliability is selected, changed-only runs require a usable API comparison base for pull requests, explicit base-sha overrides, and any trigger using fail-on: contract. If the comparison is unavailable, the action runs the full source scan and reports exit code 2 without uploading incomplete SARIF. A new-branch push with an all-zero event base still uses the source-only fallback under the default or all threshold.
With online: true and Security selected, the action starts dependency discovery in the scan directory and searches eligible ancestors. The nearest npm, pnpm, or Yarn lockfile takes precedence. If none is found, the action selects the nearest Cargo, Deno, or Bun lockfile. Advisory lookups can send eligible package names, ecosystems, and pinned versions from that inventory to OSV, including when changed-only is enabled.
The action installs its locked runtime dependencies in a runner temporary directory and runs the source at the selected action ref. It caches that built runtime with actions/cache, keyed by the Action’s own files and lock file, the runner OS and architecture, and the Node version. A later job restores the cache only after every file matches the manifest written by the build; any mismatch or cache failure falls back to a fresh install. Pull requests from forks read existing caches but never save one, and GitHub scopes pull request caches to their own ref. With only an on: pull_request trigger, as in the example above, each pull request saves its own copy, which only later runs of that pull request restore. To share one cache across pull requests and save cache quota, also run the workflow on push to the default branch. The log reports setup and scan time separately. The runtime and the cache staging directory are removed after each run, so persistent self-hosted runners do not accumulate them; the SARIF report stays in place until the upload step. SARIF, annotations and the job summary share one scan. The summary shows findings, skipped files and coverage by checker. When a workflow is cancelled, neither SARIF upload nor exit-code propagation runs.
Give the Action step an id to read its exit-code and sarif-file outputs. The exit code is the completed scan’s status, 0, 1 or 2. It is empty if the scan never wrote a result. The SARIF path is empty when upload is disabled or the scan produces no usable report. A later step can read the outputs with an appropriate condition such as if: failure() after a failing scan.