Skip to content

Commit 75ec4fc

Browse files
authored
Refactor Postman collection update workflow
Replaced the previous Postman collection transformation step with a new installation and conversion process using openapi-to-postman.
1 parent dd14a38 commit 75ec4fc

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

.github/workflows/postman-collection.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,25 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4
1919

20-
- name: Transform OpenAPI to Postman collection
21-
id: transform
22-
uses: stcalica/postman-publish-action/actions/transform-openapi-from-file@v1
23-
with:
24-
postman_api_key: ${{ secrets.POSTMAN_API_KEY }}
25-
openapi_schema_path: './spoonacular-openapi-3.json'
20+
- name: Install OpenAPI -> Postman converter
21+
run: npm i -g openapi-to-postmanv2
2622

27-
- name: Update Postman collection
28-
uses: stcalica/postman-publish-action/actions/update-collection@v1
29-
with:
30-
postman_api_key: ${{ secrets.POSTMAN_API_KEY }}
31-
collection_id: ${{ env.POSTMAN_COLLECTION_ID }}
32-
collection_data: ${{ steps.transform.outputs.postman_collection }}
23+
- name: Convert OpenAPI to Postman Collection
24+
run: |
25+
openapi2postmanv2 \
26+
-s spoonacular-openapi-3.json \
27+
-o postman-collection.json \
28+
-p
29+
30+
- name: Wrap collection JSON for Postman API
31+
run: |
32+
echo '{"collection":' > postman-collection-wrapped.json
33+
cat postman-collection.json >> postman-collection-wrapped.json
34+
echo '}' >> postman-collection-wrapped.json
35+
36+
- name: Update Postman collection via API
37+
run: |
38+
curl -X PUT "https://api.getpostman.com/collections/${POSTMAN_COLLECTION_ID}" \
39+
-H "X-Api-Key: ${{ secrets.POSTMAN_API_KEY }}" \
40+
-H "Content-Type: application/json" \
41+
--data-binary @postman-collection-wrapped.json

0 commit comments

Comments
 (0)