Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/context7-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ jobs:
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
LIBRARY_NAME: /${{ github.repository }}
run: |
curl --fail --silent --show-error --max-time 60 \
status=$(curl --silent --show-error --max-time 180 --output response.json --write-out '%{http_code}' \
-X POST https://context7.com/api/v1/refresh \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CONTEXT7_API_KEY" \
-d "{\"libraryName\": \"$LIBRARY_NAME\"}"
-d "{\"libraryName\": \"$LIBRARY_NAME\"}")
cat response.json
echo
if [ "$status" = "200" ]; then
exit 0
fi
if [ "$status" = "400" ] && jq -e '.error == "too-early"' response.json > /dev/null; then
echo "::notice::Context7 refreshed $LIBRARY_NAME recently, so it skipped this refresh."
exit 0
fi
echo "::error::Context7 refresh failed with HTTP $status."
exit 1
Loading