Skip to content

Commit 55d745d

Browse files
committed
chore: enhance Postman workflow with debugging and workspace context retrieval
1 parent f60ce66 commit 55d745d

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/postman.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,32 @@ jobs:
3939
done
4040
4141
- name: Validate Collection
42+
working-directory: ${{ github.workspace }}
4243
env:
4344
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
4445
run: |
4546
postman login --with-api-key "$POSTMAN_API_KEY"
4647
postman collection run postman/collections/Book-API
4748
49+
- name: Debug Postman workspace context
50+
if: github.event_name == 'push'
51+
working-directory: ${{ github.workspace }}
52+
run: |
53+
echo "PWD=$(pwd)"
54+
ls -la
55+
ls -la .postman
56+
postman --version
57+
echo "Workspace id from resources.yaml:"
58+
node -e "const fs=require('fs'); const text=fs.readFileSync('.postman/resources.yaml','utf8'); const m=text.match(/workspace:\s*[\r\n]+\s*id:\s*([0-9a-f-]+)/i); if(!m){console.error('workspace.id not found in .postman/resources.yaml'); process.exit(1);} console.log(m[1]);"
59+
4860
- name: Push to Postman Cloud
4961
if: github.event_name == 'push'
62+
working-directory: ${{ github.workspace }}
5063
env:
5164
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
5265
run: |
66+
WORKSPACE_ID=$(node -e "const fs=require('fs'); const text=fs.readFileSync('.postman/resources.yaml','utf8'); const m=text.match(/workspace:\s*[\r\n]+\s*id:\s*([0-9a-f-]+)/i); if(!m){process.exit(1);} process.stdout.write(m[1]);")
67+
printf '{\n "workspace": {\n "id": "%s"\n }\n}\n' "$WORKSPACE_ID" > .postman/config.json
5368
postman login --with-api-key "$POSTMAN_API_KEY"
5469
postman workspace push -y
5570

postman/collections/Book API/Books/Get Book.request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ scripts:
1313
});
1414
1515
16-
pm.test("If 200, response has book object with required properties",
16+
pm.test("If 200, response has book object with required properties.",
1717
function () {
1818
if (pm.response.code === 200) {
1919
const jsonData = pm.response.json();

0 commit comments

Comments
 (0)