Generate And Push Postman Collections #22
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: Generate And Push Postman Collections | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'api-specifications/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Postman dependencies | |
run: npm i -g openapi-to-postmanv2 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Push Postman collections | |
run: python ./scripts/push_postman_collection.py | |
env: | |
POSTMAN_MANAGEMENT: ${{ secrets.POSTMAN_MANAGEMENT }} | |
POSTMAN_WORKSPACE_ID: ${{ secrets.POSTMAN_WORKSPACE_ID }} | |
POSTMAN_PREPROD_WORKSPACE_ID: ${{ secrets.POSTMAN_PREPROD_WORKSPACE_ID }} | |
IS_PROD: 1 | |
shell: bash | |
- name: Send success notification | |
if: ${{ !env.ACT }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: criteo-api-sdk-generator | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: Postman Artefact publishing success <https://www.postman.com/realcriteo|Link to the collections>. If the environment is not prod please check the private collection. | |
SLACK_USERNAME: sdk-generation-bot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_FOOTER: '' | |
SLACK_ICON_EMOJI: green_check_mark | |
- name: Send failure notification | |
if: ${{ failure() }} && ${{ !env.ACT }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: criteo-api-sdk-generator | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: Postman Artefact publishing failure. | |
SLACK_USERNAME: sdk-generation-bot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_FOOTER: '' | |
SLACK_ICON_EMOJI: x |