generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,45 @@ Allows you to run Postman's headless collction runner, Newman, via a GitHub Acti | |
|
||
## Getting Started | ||
|
||
Currently this action only works via retrieving your collection/environment through [Postman's API](https://docs.api.getpostman.com/?version=latest). The API docs contain endpoints that will allow you to retrieve these IDs. Therefore you'll need to pass: | ||
This action supports multiple ways of retrieving your Postman collections/environments. | ||
|
||
- Your [Postman API key](https://docs.api.getpostman.com/?version=latest#authentication) | ||
- The collection ID | ||
- The environment ID | ||
### 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](https://docs.api.getpostman.com/?version=latest). 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](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for how to add your Postman API to GitHub securely. | ||
|
||
``` | ||
- uses: actions/checkout@master | ||
- uses: matt-ball/newman-action@master | ||
with: | ||
postmanApiKey: ${{ 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` | ||
This yml file should be located in `.github/workflows`. You can mix and match any of the above methods. | ||
|
||
``` | ||
name: Newman Run | ||
|
@@ -26,11 +56,16 @@ jobs: | |
newman: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: matt-ball/[email protected] | ||
- uses: actions/checkout@master | ||
- uses: matt-ball/newman-action@master | ||
with: | ||
postmanApiKey: ${{ secrets.postmanApiKey }} | ||
collection: 5922408-c22ef764-b464-424c-8702-750343478723 | ||
collection: postman_collection.json | ||
environment: 5922408-228c7edd-fc15-4f68-9665-a35d7df6945b | ||
``` | ||
|
||
See [Workflow syntax for GitHub Actions](https://help.github.com/en/articles/workflow-syntax-for-github-actions) for more. | ||
|
||
## Other settings | ||
|
||
As well as `postmanApiKey`, `collection`, and `environment`. You can pass a `reporters` option if you'd like to run a custom reporter. The default is `cli`. |