name: Automated API tests using Postman CLI

on:
  pull_request:
    branches:
      - test

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 "${{ github.workspace }}/Postman Collections/Tests.json" -e "2387160-96db1f0a-871c-4095-a671-d4f8ea251bdc" --integration-id "124557-${{ github.run_id }}"
