Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using "export-globals" #20

Open
gerome12 opened this issue Dec 21, 2020 · 4 comments
Open

using "export-globals" #20

gerome12 opened this issue Dec 21, 2020 · 4 comments

Comments

@gerome12
Copy link

Hi matt-ball,

I would like to use the option "export-globals" (https://github.com/postmanlabs/newman#command-line-options)

It's possible to adding this option to your GitHub Action ?

Thanks

Gérôme

@cynicaljoy
Copy link

The action supports all of the arguments exposed by the Postman Newman NPM module:

Looking at the documentation, --export-globals is used when executing from the command line:

--export-globals <path>
The path to the file where Newman will output the final global variables file before completing a run.

but, when executing from the JavaScript API, you should be able to use:

options.globals | Postman Global Variables can be optionally passed on to a collection run in form of path to a file or URL. It also accepts variables as an object.

Type: object | string

So, something like the following will work:

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    collection: postman_collection.json
    environment: postman_environment.json
    globals:   
        myProject:
            name: HelloWorld
            color: Yellow

@gerome12
Copy link
Author

Hi cynicaljoy,

thanks for your reply

In my case, I have multiple collections and the first one get access tokens which are used by all the others.

My wish is to do something like that :

- uses: actions/checkout@master
- uses: matt-ball/newman-action@master
  with:
    collection: get_access_tokens_collection.json
    environment: postman_environment.json
    export-globals: my_globals_environment.json
- uses: matt-ball/newman-action@master
  with:
    collection: tests_1_collection.json
    environment: postman_environment.json
    globals: my_globals_environment.json
- uses: matt-ball/newman-action@master
  with:
    collection: tests_2_collection.json
    environment: postman_environment.json
    globals: my_globals_environment.json

Is this the right way to go?

@cynicaljoy
Copy link

So it looks like in the current state the action doesn't support export-globals but could if the summary.globals was saved to an output on the action.

@yanay-clear
Copy link

@gerome12 did you find a decent solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants