diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml new file mode 100644 index 0000000..149f959 --- /dev/null +++ b/.github/workflows/context7-refresh.yml @@ -0,0 +1,40 @@ +name: Context7 refresh + +on: + push: + branches: + - master + paths: + - "README.md" + - "context7.json" + - "CHANGELOG.md" + +permissions: + contents: read + +jobs: + refresh: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Trigger a Context7 refresh + env: + CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }} + LIBRARY_NAME: /${{ github.repository }} + run: | + 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\"}") + 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 diff --git a/context7.json b/context7.json new file mode 100644 index 0000000..5a6003e --- /dev/null +++ b/context7.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://context7.com/schema/context7.json", + "url": "https://context7.com/cardmagic/simple-rss", + "public_key": "pk_veEo2smPvGYMwP1MncN1A", + "projectTitle": "simple-rss (Ruby gem)", + "description": "A liberal RSS, Atom, and JSON Feed reader for Ruby. It parses malformed feeds, fetches URLs with conditional GET, discovers feeds that websites advertise, normalizes entries, and serializes parsed feeds to JSON or XML. No runtime dependencies; requires Ruby 3.1+.", + "folders": [], + "excludeFolders": [ + "test", + "sig", + ".github" + ], + "excludeFiles": [ + "AGENTS.md", + "CLAUDE.md" + ], + "rules": [ + "Install with gem \"simple-rss\" and require \"simple-rss\". The gem requires Ruby 3.1 or newer and has no runtime dependencies.", + "Parse a string or IO with SimpleRSS.parse. Fetch a URL with SimpleRSS.fetch(url), which supports timeouts, custom headers, redirects, and conditional GET.", + "SimpleRSS.fetch returns nil when a conditional GET answers 304 Not Modified, so handle nil when you poll with ETag or Last-Modified.", + "SimpleRSS.discover finds the feeds that a website advertises. It needs gem \"nokogiri\", \">= 1.16\", \"< 2\" on CRuby; without HTML5 support it raises SimpleRSS::DiscoveryDependencyError before any request.", + "Use normalized_entries for consistent URLs, dates, content, authors, categories, and attachments across RSS, Atom, and JSON Feed.", + "simple-rss reads feeds and does not generate new ones. To write a parsed XML feed back out, use to_xml(format: :rss2) or to_xml(format: :atom). Calling to_xml on a JSON Feed raises SimpleRSSError; JSON Feed to XML conversion is not supported." + ] +}