Skip to content

Commit d8a4545

Browse files
committed
Automate postman download and update to latest collections
1 parent 49d8dc1 commit d8a4545

26 files changed

Lines changed: 471657 additions & 415592 deletions
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Update Postman Collections
2+
3+
on:
4+
schedule:
5+
- cron: "0 9 * * 1" # Monday 9am UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.23"
20+
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Save old spec
26+
run: |
27+
cd codegen && python3 extract_api_spec.py
28+
cp codegen/api_spec.json /tmp/old_spec.json
29+
30+
- name: Download collections
31+
run: cd codegen && python3 download_collections.py
32+
33+
- name: Run codegen
34+
run: |
35+
cd codegen && python3 extract_api_spec.py
36+
cd codegen && python3 generate_cli.py
37+
38+
- name: Build and vet
39+
run: |
40+
go build -o webex .
41+
go vet ./...
42+
43+
- name: Generate changelog
44+
id: changelog
45+
run: |
46+
DIFF=$(python3 codegen/diff_spec.py /tmp/old_spec.json codegen/api_spec.json)
47+
# Write to file to preserve formatting across steps
48+
echo "$DIFF" > /tmp/spec_diff.md
49+
50+
- name: Check for changes
51+
id: changes
52+
run: |
53+
if git diff --quiet; then
54+
echo "changed=false" >> "$GITHUB_OUTPUT"
55+
else
56+
echo "changed=true" >> "$GITHUB_OUTPUT"
57+
fi
58+
59+
- name: Create PR
60+
if: steps.changes.outputs.changed == 'true'
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
BRANCH="auto/update-postman-collections"
65+
git config user.name "github-actions[bot]"
66+
git config user.email "github-actions[bot]@users.noreply.github.com"
67+
git checkout -B "$BRANCH"
68+
git add -A
69+
git commit -m "Update Postman collections and regenerate CLI commands"
70+
git push -f origin "$BRANCH"
71+
if ! gh pr list --head "$BRANCH" --state open | grep -q .; then
72+
CHANGELOG=$(cat /tmp/spec_diff.md)
73+
gh pr create \
74+
--title "Update Postman collections" \
75+
--body "$(cat <<EOF
76+
## Summary
77+
78+
Automated update of Postman collections and regenerated CLI commands.
79+
80+
## API Changes
81+
82+
${CHANGELOG}
83+
EOF
84+
)" \
85+
--head "$BRANCH" \
86+
--base main
87+
fi

CLAUDE.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@ A CLI tool for Webex Calling and Contact Center APIs.
1313

1414
The files in `cmd/calling/` and `cmd/cc/` are **generated** — do not edit them by hand.
1515

16-
To regenerate after modifying codegen scripts or Postman collections:
16+
A `Makefile` orchestrates the pipeline. Key targets:
1717

1818
```bash
19-
cd codegen
20-
python3 extract_api_spec.py # reads postman/*.json → api_spec.json
21-
python3 generate_cli.py # reads api_spec.json → writes cmd/calling/*.go + cmd/cc/*.go
22-
cd ..
23-
go build -o webex .
19+
# Full pipeline (download + generate + build):
20+
make refresh
21+
22+
# Regenerate from existing committed collections:
23+
make codegen && make build
24+
25+
# Download collections only:
26+
make download
2427
```
2528

29+
No API key is required — collections are fetched from the Webex Public Workspace
30+
via Postman's public gateway.
31+
2632
## Build
2733

2834
```bash

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.PHONY: build download codegen refresh check clean
2+
3+
build:
4+
go build -o webex .
5+
6+
download:
7+
cd codegen && python3 download_collections.py
8+
9+
codegen:
10+
cd codegen && python3 extract_api_spec.py
11+
cd codegen && python3 generate_cli.py
12+
13+
refresh: download codegen build
14+
15+
check: build
16+
go vet ./...
17+
18+
clean:
19+
rm -f webex webex-cli
20+
rm -f codegen/api_spec.json codegen/api_outline.json

0 commit comments

Comments
 (0)