Skip to content

chore: synced file(s) with sumup/apis (#45) #19

chore: synced file(s) with sumup/apis (#45)

chore: synced file(s) with sumup/apis (#45) #19

name: Upload Postman Collection
on:
push:
branches:
- main
jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 20
- run: npx openapi-to-postmanv2 -s openapi.json -o SumUpAPICollection.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false
- name: Prepare Postman payload
run: |
jq '{collection: .}' SumUpAPICollection.json > postman-payload.json
- name: Upload Postman collection
env:
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
POSTMAN_COLLECTION_ID: ${{ secrets.POSTMAN_COLLECTION_ID }}
run: |
response_file="$(mktemp)"
status_code="$(
curl -sS -o "$response_file" -w "%{http_code}" \
-X PUT "https://api.getpostman.com/collections/646ec366-4881-41f6-9ec1-c19e9b22ddb7" \
-H "X-Api-Key: ${POSTMAN_API_KEY}" \
-H "Content-Type: application/json" \
--data-binary @postman-payload.json
)"
cat "$response_file"
if [[ "$status_code" -ge 400 ]]; then
echo "Postman API returned status $status_code"
exit 1
fi