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:
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.jsonWith 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 isbreakingby default. - Outputs for later steps:
gate(passorfail),breaking(a count) andreport(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:
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 1Code 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.
- uses: gitgo-hq/gitgo@main
with:
spec: openapi.yaml
scan: 'false'Every input and output is listed in the GitHub Action reference.