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:

Output
.github/
  actions/
    requestarium-run/
      action.yml
      run.sh

Then 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

.github/workflows/api-tests.yml
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: Staging

actions/checkout is needed because the action is a local folder. setup-node gives the action Node.js to run the CLI with npx.

Inputs

InputWhat it does
tokenAPI token, from a secret. Required.
collection, folderRun a collection, or one folder of it.
suiteRun a test suite from Tests, by name or id.
environment, workspaceWhich environment and workspace.
variablesExtra variables, one KEY=VALUE per line.
iterations, bailRepeat the collection; stop at the first failure.
save-runSave to the run history. Default true.
junit, html, reportReport paths. JUnit defaults to requestarium-results.xml, JSON to requestarium-report.json.
extra-argsAny other CLI flags, such as --retries 1 --max-p95 800.
api-urlA self-hosted or staging server.
cli-versionVersion of @requestarium/cli, default latest.

Set either collection or suite, not both. The action refuses to start otherwise and exits with 2.

Outputs

OutputValue
ok"true" when the run passed
junitPath of the JUnit report, empty when not written
reportPath of the JSON report

A fuller example: test the preview deployment

YAML
      - 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.html

variables 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:

YAML
          cli-version: 0.7.0