Running Newman and Postman Collections in GitHub Actions
Run your Postman collections in CI with Newman to test APIs on every change.
Newman is the CLI runner for Postman collections. In CI you export the collection and environment as JSON, run newman against them, and optionally emit JUnit for reporting. It is a quick way to turn existing Postman tests into a CI gate.
What you need
- An exported collection JSON (and optional environment JSON).
- Newman, installed via npm or the postman/newman Docker image.
- A reachable API target.
The workflow
Install Newman and run the collection with an environment.
.github/workflows/api-tests.yml
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g newman
- run: newman run ./postman/collection.json -e ./postman/staging.json --reporters cli,junit --reporter-junit-export results.xmlCommon gotchas
- Secrets baked into an exported environment file leak into the repo - use --env-var instead.
- Newman exits non-zero on any failed assertion, which is what gates the build.
- Keep collections in sync with the API or tests drift and give false confidence.
Key takeaways
- Newman runs exported Postman collections in CI.
- Pass secrets via --env-var, not committed environment files.
- A failed assertion exits non-zero and fails the build.
Related guides
Running the Storybook Test Runner in GitHub ActionsRun the Storybook test runner in GitHub Actions to smoke-test every story, with the static build served and P…
Running k6 Load Tests in GitHub ActionsRun k6 load tests in GitHub Actions with the Grafana action, enforce thresholds as pass/fail gates, and expor…
Running pytest in GitHub ActionsRun pytest in GitHub Actions across a Python version matrix with coverage and JUnit output for test reporting.