Merge pull request #116 from docusign/Click_v1-22.4.02.00 #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 Click Postman Collection | |
on: | |
push: | |
branches: | |
- master # Change this to the branch you want to trigger the action | |
paths: | |
- 'assets/click-collection.json' | |
jobs: | |
update-postman: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Update Click Postman Collection | |
env: | |
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} | |
run: | | |
# Run the Postman API to update the collection | |
GITHUB_COLLECTION_PATH="./assets/click-collection.json" | |
COLLECTION_UID=${{ vars.CLICK_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 |