Merge pull request #115 from docusign/ESignature_v2.1-25.1.00.02 #3
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 ESign | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'esignature.rest.swagger-v2.1.json' | |
jobs: | |
upload-swagger: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Send Swagger Spec to Postman API ESign | |
env: | |
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} | |
run: | | |
SWAGGER_FILE="./esignature.rest.swagger-v2.1.json" | |
API_ID=${{vars.ESIGN_API_ID}} | |
SCHEMA_ID=${{vars.ESIGN_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 |