Pipelines
AbstractCall cursor-review from a GitHub Actions or GitLab CI job to gate a pull request. It takes the pipeline event's own base and head, writes a JSON report, and exits 2 whenever coverage is incomplete.
The command
The polling service is the comment-only way to run. To invoke a review from a pipeline instead, call the command line with --ci:
cursor-review --ci --max-input-tokens 4000 > review.json
This command invokes a review and spends a model call, unless the result is already cached or the change is over budget. --estimate runs the same preparation and stops short of the model.
Fetching the commits
--ci reads the base and head from the pipeline event itself, so the job needs both commits in its checkout.
- GitHub Actions uses a
pull_requestevent and its recorded base and head SHAs. Fetch enough history, for examplefetch-depth: 0withactions/checkout. - GitLab CI uses a merge request pipeline and
CI_MERGE_REQUEST_DIFF_BASE_SHA. It takes the source branch SHA for merged-results pipelines, and the commit SHA for detached merge request pipelines. SetGIT_DEPTH: '0', or supply those Git objects some other way.
Keeping the report
The JSON report goes to stdout. Save it as a job artifact even when the job fails:
- run: cursor-review --ci --max-input-tokens 4000 > review.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: review
path: review.json
Reading the exit status
| Exit status | Meaning | For the job |
|---|---|---|
| 0 | The requested review or estimate completed in full. A review with findings also exits 0. | Pass. Read findings to decide what to do with them. |
| 2 | Partial coverage, a budget refusal, a model or tool error, or a publication failure. | Fail, or inspect the report before deciding. |
Exit 0 says the review ran to the end. It does not say the change is clean, and a finding never fails the job by itself.
What a pipeline run does not include
A pipeline run is the local form of the review. ShellCheck and actionlint run. Hadolint, zizmor and OSV-Scanner need a forge change and its CI reports, and history advisories need the poller's mined store, so both belong to the polling service.
To gate on a pull request by number, with the static checks and history included, use the polling service and read the comment it posts.