Skip to content

Commit 7fb9c33

Browse files
committed
ci: read the Context7 error field with jq
Same fix as review feedback on solid-objects-js#65. The too-early check matched the exact string "error":"too-early", so valid JSON with other spacing, such as {"error": "too-early"}, would fail the job instead of skipping. Read the field with jq. On four sample bodies, grep missed the spaced form and jq skipped it, and both still fail on another error and on a body that is not JSON. Against the live API the workflow script still exits 0 with the notice.
1 parent 787e672 commit 7fb9c33

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎.github/workflows/context7-refresh.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
if [ "$status" = "200" ]; then
3434
exit 0
3535
fi
36-
if [ "$status" = "400" ] && grep -q '"error":"too-early"' response.json; then
36+
if [ "$status" = "400" ] && jq -e '.error == "too-early"' response.json > /dev/null; then
3737
echo "::notice::Context7 refreshed $LIBRARY_NAME recently, so it skipped this refresh."
3838
exit 0
3939
fi

0 commit comments

Comments
 (0)