What does Tomosu do in CI?
| Code host | On the pull or merge request | Native report |
|---|---|---|
| GitHub | One comment, updated in place on every push | SARIF in code scanning |
| GitLab | One merge request note, updated in place | Code Quality report |
| Bitbucket | One pull request comment, updated in place | Code Insights, one annotation per finding |
Each comment carries every finding’s risk and fix. A hidden marker finds the comment again, so a run never adds a second one. A public repository never receives runtime evidence.
How do I scan pull requests on GitHub?
Add the GitHub Action. It builds the engine from source on the runner, so no account or download is needed and code never leaves the runner.
name: reliability
on: pull_request
permissions:
contents: read
pull-requests: write # the summary comment
security-events: write # SARIF upload
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # the scan compares with the base branch
- uses: tomosuai/tomosu/action@main # Coming soon
with:
mode: scan
| Input | Default | Meaning |
|---|---|---|
mode | scan | scan, index or both |
path | . | Folder to scan or index |
base | the PR’s base branch | Report only lines changed since this ref |
comment | true | Post or update the summary comment |
sarif | true | Upload SARIF to code scanning |
fail-on-findings | false | Fail the job when there are findings |
What does the comment look like?
tomosu publish --dry-run prints the comment without posting it. Each finding is a folded section with its risk and fix:
$ tomosu publish --to github --report results.json --repo acme/shop --pr 42 --dry-run <!-- reliability-scan-summary --> ### Tomosu: 17 reliability findings on the changed lines <details><summary><b>Critical</b> · <b>22.retry-repeats-one-time-action</b> · `app.py:72` in `checkout` · Pre-merge review</summary> **Risk.** A POST or PATCH is retried without an idempotency key, so if the first attempt succeeded but its reply was lost, the action happens twice. **Fix** (drop-in; unverified until your tests pass): ```diff --- a/app.py +++ b/app.py @@ -17,7 +17,8 @@ import pika # noqa: F401 the queue handler below has a pika callback's shape import requests from fastapi import FastAPI, HTTPException from opentelemetry import trace +import uuid # tomosu: 22.retry-repeats-one-time-action # Each dependency has its own address, as in a real system; in the demo they # are all served by the partners container. @@ -69,9 +70,10 @@ …
How do I set it up on GitLab or Bitbucket?
Scan to JSON, then let tomosu publish post or update the comment. On GitLab, add to .gitlab-ci.yml:
reliability:
stage: test
image: { name: ghcr.io/tomosuai/tomosu:latest, entrypoint: [""] } # Coming soon
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- tomosu scan . --format gitlab --out gl-code-quality-report.json || true
- tomosu scan . --format json --out results.json || true
- tomosu publish --to gitlab --report results.json
artifacts:
reports:
codequality: gl-code-quality-report.json
Give it a project access token with the api scope as the masked CI/CD variable GITLAB_TOKEN. On Bitbucket, run the same two commands in bitbucket-pipelines.yml under pull-requests, with --to bitbucket and a repository access token as BITBUCKET_TOKEN. The repository, pull request and commit come from each CI’s own variables.
How do I publish code indexes from CI?
On pushes to the main branch, the same Action builds a code index and pushes it to your storage, where the running engine picks it up:
- uses: tomosuai/tomosu/action@main # Coming soon
with:
mode: index
store: s3://acme-code-indexes/shop
service: shop
sign-key: ${{ secrets.INDEX_SIGN_KEY }} # optional
See Code indexes for the storage options.
Should a finding block the merge?
That is your choice. By default nothing fails: findings are reported. To fail the job, set fail-on-findings: true in the Action, or run tomosu scan --exit-code, which exits with 1 when there are findings on the changed lines.