Merge pull request #117 from docusign/Admin_v2.1-1.4.1 #1
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: Sync Admin Postman Collection | |
on: | |
push: | |
branches: | |
- master # Change this to the branch you want to trigger the action | |
paths: | |
- 'assets/admin-collection.json' | |
jobs: | |
update-postman: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Update Admin Postman Collection | |
env: | |
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} | |
run: | | |
# Run the Postman API to update the collection | |
GITHUB_COLLECTION_PATH="./assets/admin-collection.json" | |
COLLECTION_UID=${{ vars.ADMIN_COLLECTION_UID }} | |
# Read the file content and wrap it inside a collection object | |
WRAPPED_CONTENT=$(jq -n --argfile data "$GITHUB_COLLECTION_PATH" '{"collection": $data}') | |
# Write the wrapped content to a temporary file | |
echo "$WRAPPED_CONTENT" > wrapped_collection.json | |
# Use curl with --data-binary to handle large file content | |
curl --location --request PUT "https://api.getpostman.com/collections/$COLLECTION_UID" \ | |
--header "x-api-key: $POSTMAN_API_KEY" \ | |
--header "Content-Type: application/json" \ | |
--data-binary @wrapped_collection.json |