Skip to content

Check vendor API changes on every pull request

Use the GitGo GitHub Action to annotate the lines a vendor API update breaks and fail the check at the severity you choose.

Guides2 min read

Short answer

Add the gitgo-hq/gitgo action to a pull request workflow and point spec at the vendor's OpenAPI file in your repository. When a pull request changes that file, the action annotates each line of your code the change affects and fails the step when a finding reaches fail-on.

Vendor API upgrades usually arrive as a pull request that bumps an SDK or replaces a vendored OpenAPI file. The reviewer sees the file change but not the code it breaks. The GitGo Action puts the affected lines on the pull request itself.

Set it up

Keep the vendor's OpenAPI description in the repository, then add this workflow:

.github/workflows/api-upgrade.yml
name: api-upgrade
on: pull_request
permissions:
  contents: read
jobs:
  gitgo:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: gitgo-hq/gitgo@main
        with:
          spec: vendor/stripe/openapi.json

With spec, the action compares the file as it was before the pull request with the new version. If the file is new, there is nothing to compare and the step passes. To compare two files you already have, use from and to instead.

No release is tagged yet, so these examples use @main, which adds a few minutes to each run. Once a release is out, pin the action to its tag instead.

What you get

  • An annotation on each affected line of the pull request, up to 50.
  • A summary on the run page with every finding.
  • A failed step when a finding reaches fail-on, which is breaking by default.
  • Outputs for later steps: gate (pass or fail), breaking (a count) and report (the path of the SARIF or JSON report).

The step exits 0 on pass, 1 when a finding reaches fail-on, and 2 when GitGo could not run, for example because a file is missing or a spec does not parse. Exit 2 is never a pass.

Send findings to the Security tab

When scanning, the report is a SARIF 2.1.0 file. Upload it and the findings appear in the Security tab and as annotations that persist across runs:

YAML
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - id: gitgo
        uses: gitgo-hq/gitgo@main
        continue-on-error: true
        with:
          spec: vendor/stripe/openapi.json
      - uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: ${{ steps.gitgo.outputs.report }}
      - if: steps.gitgo.outputs.gate == 'fail'
        run: exit 1

Code scanning on private repositories needs GitHub Advanced Security. The step's own annotations work without it.

Check your own API before you publish it

The same action checks an API you publish. Set scan: 'false' to compare your OpenAPI file before and after the pull request without scanning code. Breaking changes are annotated on the spec file and listed in the run summary.

YAML
      - uses: gitgo-hq/gitgo@main
        with:
          spec: openapi.yaml
          scan: 'false'

Every input and output is listed in the GitHub Action reference.

Run it on your own code

The CLI is free and open source. It runs on your machine and sends nothing anywhere.