Skip to content

Commit

Permalink
readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-ball committed Nov 11, 2020
1 parent f730d83 commit fdeaa16
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Newman Action

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

## Getting Started

Expand Down Expand Up @@ -29,7 +29,7 @@ If you're collection and/or environment is sitting at a URL accessible to your G
```

### 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.
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://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) for how to add your Postman API to GitHub securely.

```
- uses: actions/checkout@master
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
with:
postmanApiKey: ${{ secrets.postmanApiKey }}
apiKey: ${{ secrets.postmanApiKey }}
collection: postman_collection.json
environment: 5922408-228c7edd-fc15-4f68-9665-a35d7df6945b
```
Expand All @@ -68,4 +68,4 @@ See [Workflow syntax for GitHub Actions](https://help.github.com/en/articles/wor

## Other settings

As well as `postmanApiKey`, `collection`, and `environment`, all other Newman settings are supported. You can find a full list [on the Newman docs](https://github.com/postmanlabs/newman#api-reference).
As well as `apiKey`, `collection`, and `environment`, all other Newman settings are supported. You can find a full list [on the Newman docs](https://github.com/postmanlabs/newman#api-reference). 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.
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function init () {
delayRequest: Number(get('delayRequest')),
ignoreRedirects: safeParse(get('ignoreRedirects')),
insecure: safeParse(get('insecure')),
bail: safeParse(get('bail')), // check
bail: safeParse(get('bail')),
suppressExitCode: safeParse(get('suppressExitCode')),
reporters: split(get('reporters')),
reporter: safeParse(get('reporter')),
Expand Down Expand Up @@ -59,13 +59,15 @@ async function init () {
}

function safeParse (obj) {
try {
return JSON.parse(obj)
} catch (e) {
console.log(obj)
core.warning('Bad object passed in config!')
return null
if (obj) {
try {
return JSON.parse(obj)
} catch (e) {
core.warning('Bad object passed in config!')
}
}

return null
}

function split (str) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newman-action",
"version": "0.1.6",
"version": "0.2.0",
"description": "Run Postman collections with Newman as a GitHub Action",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit fdeaa16

Please sign in to comment.