Giter Site home page Giter Site logo

copelandsoftware / newman-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matt-ball/newman-action

0.0 1.0 0.0 48.58 MB

Use Postman's headless collection runner, Newman, via a GitHub Action.

License: Apache License 2.0

JavaScript 95.35% Makefile 4.65%

newman-action's Introduction

Notice

This Action is not an official Postman release. As of Postman v10, Postman will now automatically create a configuration for GitHub Actions. This is the recommended approach. For more information, please follow the below link:

https://learning.postman.com/docs/integrations/available-integrations/ci-integrations/github-actions/#configuring-the-postman-cli-for-github-actions

Newman Action

Allows you to run Postman's headless collection runner, Newman, via a GitHub Action meaning no config of the Newman lib itself.

Getting Started

This action supports multiple ways of retrieving your Postman collections/environments.

Local files

If you've exported your collection and/or environment to your repo, provide the relative path to where the file sits in your repo (default: postman_collection.json / postman_environment.json).

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    collection: postman_collection.json
    environment: postman_environment.json

Via URL

If you're collection and/or environment is sitting at a URL accessible to your GitHub action, you can include that directly.

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    collection: https://example.com/postman/collection.json
    environment: https://example.com/postman/environment.json

Via Postman API

The latest version of your collection and/or environment is available through Postman's API. The API docs contain endpoints that will allow you to retrieve the required IDs. Passing these IDs along with your Postman API key will run Newman in this method. See Creating and using secrets for how to add your Postman API to GitHub securely.

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    apiKey: ${{ secrets.postmanApiKey }}
    collection: 5922408-c22ef764-b464-424c-8702-750343478723
    environment: 5922408-228c7edd-fc15-4f68-9665-a35d7df6945b

Example workflow file

This yml file should be located in .github/workflows. You can mix and match any of the above methods.

name: Newman Run

on:
  pull_request:
    branches:
    - master

jobs:
  newman:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: matt-ball/newman-action@master
        with:
          apiKey: ${{ secrets.postmanApiKey }}
          collection: postman_collection.json
          environment: 5922408-228c7edd-fc15-4f68-9665-a35d7df6945b

See Workflow syntax for GitHub Actions for more.

Other settings

As well as apiKey, collection, and environment, all other Newman settings are supported. You can find a full list on the Newman docs. This action uses the Node module under the hood, so ensure you are reading the API reference rather than the command line options. Alternatively, you can see the available options in action.yml in this repo.

Note that:

  • GitHub Actions only supports string, number and boolean types. For fields that require objects/arrays, you will need to stringify them appropriately.
  • environment and globals are only supported as a string in this Action. They cannot be passed stringified objects.
  • reporters is only supported as a stringified object.

The following example demonstrates these notes in practice:

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    collection: postman_collection.json
    environment: postman_environment.json
    reporters: '["emojitrain"]'
    delayRequest: 5000
    envVar: '[{ "key": "url", "value": "http://localhost:3000" }]'

newman-action's People

Contributors

konifar avatar matt-ball avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.