Claude Code GitHub Actions: API Tests on Each PR
Claude Code GitHub Actions opens the pull request; a second workflow runs your API tests on it. Set up both, and fix the check that never starts.

To run API tests on every pull request that Claude Code opens, keep two separate workflows: the Claude Code GitHub Action, which writes the change, and a CI workflow that runs your API tests on the pull request. npx stresseur init-ci writes the second one. The usual failure is that the second workflow never starts on the agent’s commits, because GitHub does not trigger workflows on commits made with the default GITHUB_TOKEN. The sections below cover the setup, that fix, and what the check reports.
The setup: one workflow writes the code, another tests it
Claude Code GitHub Actions is a GitHub Action that runs Claude Code inside your repository’s workflows. You mention @claude in a pull request or issue comment, and it analyzes code, implements changes and pushes commits. It does not run your API tests for you. A coding agent needs API tests it can run after every change, and CI needs the same test, so the pull request is checked no matter who wrote it.
Stresseur is not part of the Claude Code action. The Stresseur workflow is its own file, .github/workflows/stresseur.yml, and the two meet at the pull request. The setup has three steps:
- Record flows and add the workflow with
npx stresseur init-ci. - Set up the Claude Code action and tell the agent to run the flows before it pushes.
- Check that Claude’s commits start your CI.
The third step is the one people skip, and it is the one that decides whether the first two do anything.
Step 1: add the API test workflow with init-ci
Run npx stresseur init-ci in the repository. It writes .github/workflows/stresseur.yml. On each pull request and push to the default branch, the workflow starts your app, runs the flows and uploads the timings.
The app starts from, in order: a root Docker Compose file, a Dockerfile, or a package.json start or dev script. init-ci also warns when your flows call a separate API, and it lists what your app needs in CI: a database, and variables left empty in .env.example.
Record the flows first. init-ci will not write a workflow while the flow directory is empty. The CI setup docs cover the rest of the workflow.
You do not need to create a token for the upload. Uploads use GitHub OIDC, so there is no token to store. For the pull_request trigger, secrets on forks and required checks, see the guide to API tests on every pull request.
Step 2: let Claude Code open the pull request
On the Claude side, the quick path is to run /install-github-app from Claude Code. The Claude Code GitHub Actions docs cover the manual setup as well. When the workflow provides no prompt input, the action runs in interactive mode and waits for the trigger phrase, @claude by default, in an issue or pull request comment, in a pull request review, or in the body or title of a newly opened issue.
Put the testing rule where the agent reads it. A CLAUDE.md file in the repository root defines code style, review criteria and project-specific rules, and Claude follows it when creating pull requests. Add one line there: after changing an endpoint, run npx stresseur flow run on the affected flow before pushing. flow run runs a flow locally. The TDD with Claude Code post shows that loop in order, test first.
The action has a second mode. When the workflow provides a prompt input, Claude runs without waiting for a mention, subject only to the checks on who can trigger runs. In the workflow permissions, actions: read lets Claude read CI results on pull requests. Two rules limit who can start a run. The triggering user must have write access to the repository on issue and pull request events. The action also rejects a bot actor unless you list it in allowed_bots, so a bot that comments @claude when a check fails is ignored until you list it.
npx stresseur install-skill writes the agent files: .claude/skills/stresseur/SKILL.md, a section in AGENTS.md, and .cursor/rules/stresseur.mdc. The page for coding agents shows the setup end to end.
Why the check does not start on Claude’s commits
The failure that costs the most time looks like this: Claude pushes its commits, and the Stresseur check never appears on the pull request. GitHub does not trigger workflows on commits made with the default GITHUB_TOKEN. GitHub’s own documentation says the same of events the token triggers: they will not create a new workflow run, with exceptions such as workflow_dispatch and repository_dispatch. The GitHub token reference lists them.
The fix sits in the Claude step of your workflow. If you pass github_token: ${{ secrets.GITHUB_TOKEN }} to the Claude Code GitHub Action, remove it so it authenticates as the Claude GitHub App, or pass a custom app token instead.
Then check the other half. Your CI workflow’s triggers must include the events Claude’s pushes produce, such as push or pull_request. The workflow from init-ci runs on each pull request, so the pull request side is covered once the token is right.
To debug, open the pull request and look at the checks list. If no Stresseur check is there at all, the workflow did not start, and the token is the first thing to look at. If the check is there and red, read it as you would for a commit from a person.
What the check shows and when it blocks the merge
Each pull request gets one check, Stresseur / performance, and one comment that is updated in place on each push. In CI the workflow runs each flow 13 times, one warm-up and 12 measured, and uploads per-step timings.
Whether the check blocks the merge depends on the gate. On GitHub-hosted runners the default gate only warns, and a fail_above you write always applies. Free plans warn only. The gates docs show how to set the threshold. Make the check required in your branch protection rules if you want a failing result to stop the agent’s pull request.
A flow is flagged when its median is at least 10% slower than the baseline and outside its normal run-to-run variation. The baseline is the last 30 comparable runs on the default branch. With fewer than 10 baseline runs it only warns. A slow CI machine shows as “Runner noise”, never a failure. That matters for an agent’s change: a change can pass every test and still slow a flow. Two slower pull requests shows what that looks like when it is caught.
For a failing step instead of a slow one, run npx stresseur ci before you push. It runs every flow several times and reports per step, and it exits 1 if any step failed. Tell the agent to run it and read the failing step. The same idea applies to AI code testing in general.
A checklist when the check is missing or only warns
Work through these in order when a pull request from the agent shows no Stresseur check, or a check that does not block.
- No check at all. The workflow did not start. Remove
github_token: ${{ secrets.GITHUB_TOKEN }}from the Claude step, and confirm your CI triggers include the events Claude’s pushes produce. - No workflow file.
init-cidoes not write a workflow while the flow directory is empty, so record flows first. - A check that warns but never fails. On GitHub-hosted runners the default gate only warns, and Free plans warn only.
- A warning while the baseline is young. With fewer than 10 baseline runs the check only warns.
Conclusion
Claude Code writes the pull request, and a second workflow tests it. Add the Stresseur workflow with npx stresseur init-ci, point the agent at the flows in CLAUDE.md, and keep the Claude step off the default GITHUB_TOKEN so its commits start your CI. Then read the check on the next pull request the agent opens.
Frequently asked questions
Does Stresseur work with the Claude Code GitHub Action?
The two are separate workflows that you set up on their own. `npx stresseur init-ci` writes `.github/workflows/stresseur.yml`, and it runs on each pull request and push to the default branch.
Does the Claude Code GitHub Action use my GitHub Actions minutes?
Yes. The action runs on GitHub-hosted runners, which consume your GitHub Actions minutes.
Can Cursor use the same setup?
The workflow from `init-ci` runs on each pull request and push to the default branch. On the agent side, `npx stresseur install-skill` writes the Claude Code skill, a section in `AGENTS.md` and a Cursor rule.
What happens to AI checks on pull requests from forks?
On fork pull requests the judge checks are skipped with a reason, never failed.
Do I need to store a Stresseur token as a GitHub secret?
No. Uploads use GitHub OIDC, so there is no token to store.