@@ -134,18 +134,36 @@ jobs:
134134 # entry (static `vars.X` resolved at matrix-expansion time); the
135135 # secret supplies the API key. Both are validated below before any
136136 # network call.
137+ #
138+ # We capture the HTTP status with curl's `-w "%{http_code}"` and
139+ # branch on it explicitly rather than relying on `--fail-with-body`,
140+ # so the workflow logs report a clear ✓/✗ line for the PUT and dump
141+ # the response body on failure. The PUT response shape is
142+ # {"collection": {"id", "name", "uid"}} — name/uid live directly on
143+ # `.collection`, not under `.collection.info` (that nested path is
144+ # the *collection schema* shape, not the PUT envelope).
137145 env :
138146 POSTMAN_API_KEY : ${{ secrets.POSTMAN_API_KEY }}
139147 COLLECTION_ID : ${{ matrix.collection_id }}
140148 run : |
141149 : "${POSTMAN_API_KEY:?missing repo secret POSTMAN_API_KEY}"
142150 : "${COLLECTION_ID:?missing repo variable for ${{ matrix.name }} collection ID — check Settings → Variables}"
143151
144- curl --fail-with-body -sS -X PUT \
152+ http_status=$( curl -sS -X PUT \
145153 "https://api.getpostman.com/collections/$COLLECTION_ID" \
146154 -H "X-Api-Key: $POSTMAN_API_KEY" \
147155 -H "Content-Type: application/json" \
148156 --data-binary @payload.json \
149- -o response.json
150- echo "Postman response:"
151- jq '.collection.info | {name, uid}' response.json || cat response.json
157+ -o response.json \
158+ -w "%{http_code}")
159+
160+ if [[ "$http_status" =~ ^2[0-9][0-9]$ ]]; then
161+ echo "✓ Postman PUT succeeded (HTTP $http_status) for ${{ matrix.name }}"
162+ jq -r '.collection | " name: \(.name)\n uid: \(.uid)"' response.json \
163+ || cat response.json
164+ else
165+ echo "✗ Postman PUT failed (HTTP $http_status) for ${{ matrix.name }}"
166+ echo "Response body:"
167+ cat response.json
168+ exit 1
169+ fi
0 commit comments