AI Context Review #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AI Context Review | |
| on: | |
| schedule: | |
| # Every 3 days at 09:00 UTC | |
| - cron: '0 9 */3 * *' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| issues: write | |
| contents: read | |
| jobs: | |
| review: | |
| name: Check SDK versions & endpoints | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check SDK versions and endpoints | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| NL=$'\n' | |
| REPORT="" | |
| HAS_ISSUES=false | |
| # ── helpers ───────────────────────────────────────────── | |
| add() { REPORT="${REPORT}${1}${NL}"; } | |
| flag() { HAS_ISSUES=true; } | |
| check_npm() { | |
| local pkg="$1" label="$2" | |
| local version | |
| version=$(npm view "$pkg" version 2>/dev/null || echo "NOT_FOUND") | |
| echo "$label: $version" | |
| if [ "$version" = "NOT_FOUND" ]; then flag; fi | |
| add "| ${label} | \`${pkg}\` | \`${version}\` |" | |
| } | |
| check_gh_release() { | |
| local repo="$1" label="$2" | |
| local tag | |
| tag=$(gh api "repos/${repo}/releases/latest" --jq '.tag_name' 2>/dev/null || echo "NONE") | |
| if [ "$tag" = "NONE" ]; then | |
| tag=$(gh api "repos/${repo}/tags?per_page=1" --jq '.[0].name' 2>/dev/null || echo "NOT_FOUND") | |
| fi | |
| echo "$label: $tag" | |
| if [ "$tag" = "NOT_FOUND" ]; then flag; fi | |
| add "| ${label} | [${repo}](https://github.com/${repo}) | \`${tag}\` |" | |
| } | |
| check_endpoint() { | |
| local url="$1" label="$2" | |
| local status | |
| status=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$url" 2>/dev/null || echo "TIMEOUT") | |
| local icon="✅" | |
| if [ "$status" != "200" ] && [ "$status" != "301" ] && [ "$status" != "302" ]; then | |
| icon="❌" | |
| flag | |
| fi | |
| add "| ${icon} | ${label} | \`${url}\` | ${status} |" | |
| } | |
| # ── npm packages ──────────────────────────────────────── | |
| add "### npm Packages" | |
| add "" | |
| add "| SDK | Package | Latest Version |" | |
| add "|-----|---------|----------------|" | |
| check_npm "@0gfoundation/0g-ts-sdk" "TypeScript Storage SDK" | |
| check_npm "@0glabs/0g-serving-broker" "Compute CLI" | |
| add "" | |
| # ── GitHub releases ───────────────────────────────────── | |
| add "### GitHub Releases / Tags" | |
| add "" | |
| add "| Component | Repository | Latest Tag |" | |
| add "|-----------|------------|------------|" | |
| check_gh_release "0gfoundation/0g-storage-client" "Go Storage Client/CLI" | |
| add "" | |
| # ── Endpoint health ───────────────────────────────────── | |
| add "### Endpoint Health" | |
| add "" | |
| add "| Status | Label | URL | HTTP Code |" | |
| add "|--------|-------|-----|-----------|" | |
| check_endpoint "https://evmrpc-testnet.0g.ai" "Testnet RPC" | |
| check_endpoint "https://evmrpc.0g.ai" "Mainnet RPC" | |
| check_endpoint "https://indexer-storage-testnet-turbo.0g.ai/file/info/0x0000000000000000000000000000000000000000000000000000000000000000" "Testnet Storage Indexer API" | |
| check_endpoint "https://indexer-storage-turbo.0g.ai/file/info/0x0000000000000000000000000000000000000000000000000000000000000000" "Mainnet Storage Indexer API" | |
| check_endpoint "https://chainscan-galileo.0g.ai" "Testnet Explorer" | |
| check_endpoint "https://chainscan.0g.ai" "Mainnet Explorer" | |
| check_endpoint "https://storagescan-galileo.0g.ai" "Testnet Storage Explorer" | |
| check_endpoint "https://faucet.0g.ai" "Faucet" | |
| check_endpoint "https://cloud.google.com/application/web3/faucet/0g/galileo" "Google Cloud Faucet" | |
| add "" | |
| # ── SDK README keyword scan ───────────────────────────── | |
| add "### SDK README Changes" | |
| add "" | |
| TS_README=$(curl -sL "https://raw.githubusercontent.com/0gfoundation/0g-ts-sdk/main/README.md" 2>/dev/null) | |
| if echo "$TS_README" | grep -qi "breaking\|migration\|deprecated"; then | |
| add "⚠️ **TypeScript SDK README** may contain breaking changes or deprecation notices — review manually." | |
| flag | |
| else | |
| add "✅ TypeScript SDK README — no breaking change keywords detected." | |
| fi | |
| GO_README=$(curl -sL "https://raw.githubusercontent.com/0gfoundation/0g-storage-client/main/README.md" 2>/dev/null) | |
| if echo "$GO_README" | grep -qi "breaking\|migration\|deprecated"; then | |
| add "⚠️ **Go SDK README** may contain breaking changes or deprecation notices — review manually." | |
| flag | |
| else | |
| add "✅ Go SDK README — no breaking change keywords detected." | |
| fi | |
| # ── Write report and flag ─────────────────────────────── | |
| echo "has_issues=$HAS_ISSUES" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "## AI Context Page Review" | |
| echo "" | |
| echo "Automated review of SDK versions, endpoints, and contract addresses referenced in \`docs/ai-context.md\`." | |
| echo "" | |
| echo "$REPORT" | |
| echo "---" | |
| echo "*Review \`docs/ai-context.md\` and update any stale information. Close this issue when done.*" | |
| } > /tmp/report.md | |
| - name: Create issue if problems found | |
| if: steps.check.outputs.has_issues == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Ensure labels exist | |
| gh label create "ai-context-review" --description "Automated AI context page review" --color "0E8A16" 2>/dev/null || true | |
| gh label create "documentation" --color "0075ca" 2>/dev/null || true | |
| # Close previous review issues | |
| gh issue list \ | |
| --label "ai-context-review" \ | |
| --state open \ | |
| --json number \ | |
| --jq '.[].number' | while read -r num; do | |
| gh issue close "$num" --comment "Superseded by new review." 2>/dev/null || true | |
| done | |
| # Create new issue | |
| gh issue create \ | |
| --title "[Automated] AI Context Review — $(date +%Y-%m-%d)" \ | |
| --body-file /tmp/report.md \ | |
| --label "ai-context-review,documentation" | |
| - name: All clear | |
| if: steps.check.outputs.has_issues != 'true' | |
| run: echo "✅ All checks passed — no issue created." |