Created
June 10, 2024 14:47
-
-
Save DannyDainton/35b180cf06023323fad67dce013409c0 to your computer and use it in GitHub Desktop.
A basic workflow file that can be used to run your Postman Collection through a GitHub Action using specific configurations. The result are presented in the GitHub Action console and also on the runs section of the Postman Collection.
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
name: Automated API tests using Postman CLI | |
run-name: The Collection run was started by ${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
collection-uid: | |
required: true | |
type: string | |
description: 'The Collection UID for the run' | |
iterations: | |
description: 'Number of iterations to run' | |
required: false | |
type: string | |
use-verbose-output: | |
type: boolean | |
description: Include the detailed request and response data | |
jobs: | |
automated-api-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Postman CLI | |
run: | | |
curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh | |
- name: Login to Postman CLI | |
run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }} | |
- name: Run API tests | |
run: | | |
postman collection run ${{ inputs.collection-uid }} -n ${{ inputs.iterations || 1 }} ${{inputs.use-verbose-output && '--verbose' || ''}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment