From fdeaa163e1a3d01d4ada53f9a1d25e9608474e68 Mon Sep 17 00:00:00 2001 From: Matt Ball Date: Wed, 11 Nov 2020 15:54:44 +0000 Subject: [PATCH] readme updates --- README.md | 8 ++++---- index.js | 16 +++++++++------- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 30a23818c..447b0a711 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 ``` @@ -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. diff --git a/index.js b/index.js index 97536a130..984c1f62e 100644 --- a/index.js +++ b/index.js @@ -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')), @@ -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) { diff --git a/package-lock.json b/package-lock.json index dc2381e3e..f72d01b20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "newman-action", - "version": "0.1.6", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7fce41d77..426ab0b59 100644 --- a/package.json +++ b/package.json @@ -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": {