Run API tests with the Requestarium GitHub Action
You can run the Requestarium CLI in any GitHub Actions step by hand. The requestarium-run action saves you the boilerplate: it installs the CLI, builds the command from a few inputs, writes the reports and exposes the result as outputs.
Add the action to your repository
The action lives in the Requestarium repository as a composite action. Copy the folder into yours:
.github/
actions/
requestarium-run/
action.yml
run.shThen add a token: create one in Settings → API tokens (on the Team plan, an organization token from Settings ▸ API tokens ▸ Organization tokens doesn't belong to a person) and store it as the repository secret REQUESTARIUM_TOKEN.
The smallest workflow
name: API tests
on: [push, pull_request]
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: ./.github/actions/requestarium-run
with:
token: ${{ secrets.REQUESTARIUM_TOKEN }}
collection: Users API
environment: Stagingactions/checkout is needed because the action is a local folder. setup-node gives the action Node.js to run the CLI with npx.
Inputs
| Input | What it does |
|---|---|
token | API token, from a secret. Required. |
collection, folder | Run a collection, or one folder of it. |
suite | Run a test suite from Tests, by name or id. |
environment, workspace | Which environment and workspace. |
variables | Extra variables, one KEY=VALUE per line. |
iterations, bail | Repeat the collection; stop at the first failure. |
save-run | Save to the run history. Default true. |
junit, html, report | Report paths. JUnit defaults to requestarium-results.xml, JSON to requestarium-report.json. |
extra-args | Any other CLI flags, such as --retries 1 --max-p95 800. |
api-url | A self-hosted or staging server. |
cli-version | Version of @requestarium/cli, default latest. |
Set either collection or suite, not both. The action refuses to start otherwise and exits with 2.
Outputs
| Output | Value |
|---|---|
ok | "true" when the run passed |
junit | Path of the JUnit report, empty when not written |
report | Path of the JSON report |
A fuller example: test the preview deployment
- id: deploy
run: echo "url=https://pr-${{ github.event.number }}.preview.example.com" >> "$GITHUB_OUTPUT"
- id: api
uses: ./.github/actions/requestarium-run
with:
token: ${{ secrets.REQUESTARIUM_TOKEN }}
suite: Smoke
environment: Preview
variables: |
baseUrl=${{ steps.deploy.outputs.url }}
apiKey=${{ secrets.PREVIEW_API_KEY }}
html: api-report.html
extra-args: --retries 1
- uses: actions/upload-artifact@v4
if: always()
with:
name: api-report
path: api-report.htmlvariables override the environment for this run only. Secret values passed this way go through --var; mark the matching environment variables secret in the app so reports mask them.
What you see in GitHub
- The step's log shows each request with its status and tests.
- The job summary gets a table of results, and each failed request gets an error annotation.
- With
save-run: true, the run appears in the collection's or suite's Runs in Requestarium, with the branch, the commit and a link back to the job.
Pin the version
cli-version: latest is convenient, but a new CLI release could change a report format mid-sprint. Pin it once things work:
cli-version: 0.7.0