Merge pull request #111 from docusign/dev_mudit #1
This file contains hidden or 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: Postman API Integration for Rooms | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'rooms.rest.swagger-v2.json' | |
jobs: | |
upload-swagger: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Send Swagger Spec to Postman API Rooms | |
env: | |
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} | |
run: | | |
SWAGGER_FILE="./rooms.rest.swagger-v2.json" | |
API_ID=${{vars.ROOMS_API_ID}} | |
SCHEMA_ID=${{vars.ROOMS_DEFINITION_ID}} | |
FILE_PATH="index.json" | |
# Read the Swagger file content and escape it properly for JSON | |
CONTENT=$(cat "$SWAGGER_FILE" | jq -Rs .) | |
# Create the JSON payload with the file content as a string | |
JSON_PAYLOAD="{\"content\": $CONTENT}" | |
# Write the JSON payload to a temporary file | |
echo "$JSON_PAYLOAD" > payload.json | |
# Use curl with --data-binary to handle large file content | |
curl --location --request PUT "https://api.getpostman.com/apis/$API_ID/schemas/$SCHEMA_ID/files/$FILE_PATH" \ | |
--header "Accept: application/vnd.api.v10+json" \ | |
--header "Content-Type: application/json" \ | |
--header "X-Api-Key: $POSTMAN_API_KEY" \ | |
--data-binary @payload.json |