Product
Platform overview Tomosu engine (open source) Tomosu Cloud Reliability rules
Solutions
Prevent outages before merge Reliability Radar Fix safety For developers For SRE and platform teams
Developers
Quickstart Documentation Contribute a rule
Resources
Blog Case studies Learn FAQ News
Company
Pricing About Contact Join the Waitlist
Theme

CI and pull request comments

In CI, Tomosu scans each pull request and reports in the places your team already looks. The GitHub Action scans the change, uploads SARIF to code scanning and keeps one comment up to date; tomosu publish does the same for GitLab and Bitbucket. On the main branch the same job publishes the code index the running engine needs.

  • GitHub Action
  • tomosu publish
  • SARIF 2.1.0
  • Updated

What does Tomosu do in CI?

Code hostOn the pull or merge requestNative report
GitHubOne comment, updated in place on every pushSARIF in code scanning
GitLabOne merge request note, updated in placeCode Quality report
BitbucketOne pull request comment, updated in placeCode 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
InputDefaultMeaning
modescanscan, index or both
path.Folder to scan or index
basethe PR’s base branchReport only lines changed since this ref
commenttruePost or update the summary comment
sariftrueUpload SARIF to code scanning
fail-on-findingsfalseFail 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.