Skip to content

Commit 077f8a1

Browse files
committed
fix(ci): only download specs if not already in checkout
Twilio spec (twilio.json) is tracked in git. The CI was downloading a fresh copy that has Unicode escape issues. Now only downloads specs that are gitignored (Stripe, OpenAI) and uses committed files when available.
1 parent 28a3d8f commit 077f8a1

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,35 @@ jobs:
9292
env:
9393
GH_TOKEN: ${{ github.token }}
9494

95-
- name: Download API specs
95+
- name: Download API specs (if not in checkout)
9696
run: |
9797
case "${{ matrix.sample.name }}" in
9898
stripe)
99-
curl -sf -L -o third-party-apis/stripe-api/stripe.yaml \
100-
"https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml"
101-
echo "Downloaded Stripe spec ($(wc -c < third-party-apis/stripe-api/stripe.yaml) bytes)"
99+
if [ ! -f third-party-apis/stripe-api/stripe.yaml ]; then
100+
curl -sf -L -o third-party-apis/stripe-api/stripe.yaml \
101+
"https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml"
102+
echo "Downloaded Stripe spec"
103+
else
104+
echo "Stripe spec already in checkout ($(wc -c < third-party-apis/stripe-api/stripe.yaml) bytes)"
105+
fi
102106
;;
103107
twilio)
104-
curl -sf -L -o third-party-apis/twilio-api/twilio.json \
105-
"https://raw.githubusercontent.com/twilio/twilio-oai/main/spec/json/twilio_api_v2010.json"
106-
echo "Downloaded Twilio spec ($(wc -c < third-party-apis/twilio-api/twilio.json) bytes)"
108+
if [ ! -f third-party-apis/twilio-api/twilio.json ]; then
109+
curl -sf -L -o third-party-apis/twilio-api/twilio.json \
110+
"https://raw.githubusercontent.com/twilio/twilio-oai/main/spec/json/twilio_api_v2010.json"
111+
echo "Downloaded Twilio spec"
112+
else
113+
echo "Twilio spec already in checkout ($(wc -c < third-party-apis/twilio-api/twilio.json) bytes)"
114+
fi
107115
;;
108116
openai)
109-
curl -sL -o third-party-apis/openai-api/openai.yaml \
110-
"https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml"
111-
echo "Downloaded OpenAI spec ($(wc -c < third-party-apis/openai-api/openai.yaml) bytes)"
117+
if [ ! -f third-party-apis/openai-api/openai.yaml ]; then
118+
curl -sL -o third-party-apis/openai-api/openai.yaml \
119+
"https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml"
120+
echo "Downloaded OpenAI spec"
121+
else
122+
echo "OpenAI spec already in checkout ($(wc -c < third-party-apis/openai-api/openai.yaml) bytes)"
123+
fi
112124
;;
113125
esac
114126

0 commit comments

Comments
 (0)