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 Kamble
Founder & QA Engineer at SoftwareTestPilot
Reviewed by Priyanka G.
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 Kamble, reviewed by Priyanka G.

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.

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.
Keep going

Practice these questions

Rehearse REST, Postman, REST Assured and contract-testing questions with worked examples.

Found this useful?
Share:XLinkedInWhatsApp

Was this article helpful?

Cluster · API Testing

More from REST API Testing

REST fundamentals — verbs, status codes, contracts.

Pillar guide · 36 articles
More in this cluster
From the API Testing pillar

Keep building your QA edge

Practice these questions live

Rehearse with an AI QA interviewer that scores your answers in real time.

Start a Free AI Mock Interview →

Continue reading

Topic mapConcepts · Tools · People · Standards

Related concepts, tools & standards around API Testing

A quick reference of the people, companies, frameworks and technologies most often mentioned alongside API Testing in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.

Core testing concepts
OAuth 2.0JWT AuthenticationIdempotencyTest PyramidShift-Left TestingBehavior-Driven DevelopmentTest-Driven DevelopmentPage Object ModelContract TestingExploratory Testing
Programming languages
JavaPythonJavaScriptTypeScriptC#SQL
Certifications worth knowing
ISTQB Foundation LevelISTQB Advanced — Test AnalystISTQB Agile TesterCertified Selenium ProfessionalAWS Certified DevOps EngineerCertified ScrumMaster (CSM)
Companies hiring for this skill
GoogleMicrosoftAmazonMetaNetflixAtlassianThoughtWorksInfosysTCSWipro

Discussion

Ask a question, share your experience, or correct us. Be kind — real people are reading.

Join the QA Community

Connect with fellow testers, share job leads, and get career advice.

Premium QA Resources

Stop Reinventing the Wheel. Upgrade Your QA Arsenal.

Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.

  • Ready-to-use testing strategy templates
  • Advanced API & UI automation guides
  • ⏱️ Save 10+ hours a week on test planning
4.9/5 rating
Explore All Products

⭐⭐⭐⭐⭐ Trusted by 1,000+ Software Test Pilots • Instant Access