SoftwareTestPilot
API TestingPublished: 10 min read

Postman Newman CLI — CI/CD Guide with GitHub Actions (2026)

Run Postman collections in CI with Newman: exit codes, HTML reports, environment secrets, parallel execution, and a copy-paste GitHub Actions workflow that fails builds on API regressions.

Avinash K
Founder & QA Engineer at SoftwareTestPilot
Share:XLinkedInWhatsApp
Newman CLI running a Postman collection inside a GitHub Actions job.
Newman CLI running a Postman collection inside a GitHub Actions job.

Last updated 2026-07-20 · 10 min read · By Avinash K

Newman is the missing piece between a Postman collection and a passing CI build. This guide covers install, HTML reporting, secret injection, parallel runs, and a copy-paste GitHub Actions workflow that turns any collection into a merge-blocking check in under 15 minutes.

Key takeaways

  • Install Newman + reporters in one command.
  • Secret injection without leaking to logs.
  • HTML + JUnit reports for PR comments.
  • A production-ready GitHub Actions workflow.

1. Install Newman + reporters

npm install -g newman newman-reporter-htmlextra
newman run collection.json \
  -e env.json \
  -r cli,htmlextra,junit \
  --reporter-junit-export report.xml

2. Secret injection

newman run collection.json \
  --env-var "API_TOKEN=$API_TOKEN" \
  --env-var "BASE_URL=$BASE_URL"

Never commit env.json with secrets — always use --env-var from CI environment variables.

3. GitHub Actions workflow

name: API Regression
on: [pull_request]
jobs:
  newman:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - run: npm install -g newman newman-reporter-htmlextra
      - name: Run collection
        env:
          API_TOKEN: ${{ secrets.API_TOKEN }}
        run: |
          newman run collection.json \
            --env-var "API_TOKEN=$API_TOKEN" \
            -r cli,htmlextra,junit \
            --reporter-htmlextra-export report.html \
            --reporter-junit-export report.xml
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: newman-report
          path: report.html
      - uses: dorny/test-reporter@v1
        if: always()
        with:
          name: Newman
          path: report.xml
          reporter: java-junit

4. Parallel execution

Newman does not fork by default. Split collections by folder and run them in a matrix job, or use newman-run-parallel for local parallelism. For long-running suites, convert to REST Assured or export to Playwright — both parallelise natively.

Newman collections scale poorly when every service owns its own suite. Read our microservices testing strategy before you standardise collections across teams, and shift-left testing in DevOps for where to run them in the pipeline.

Frequently asked questions

1.Newman exit codes?
0 = success, 1 = test failures. CI systems pick this up automatically.
2.Can Newman run pre-request scripts?
Yes — all Postman sandbox scripts run identically in Newman, including pm.sendRequest for chained auth.
3.How do I attach the report to PR comments?
Use dorny/test-reporter for JUnit surface, and actions/upload-artifact for the HTML report. Third-party actions can post an inline PR comment.
4.Is Newman replaced by Postman CLI?
Postman CLI is Postman's newer runner, but Newman is still the OSS standard and works without a Postman account.