chore: automate schemata version updates#33
Conversation
- Add .schemata-version as single source of truth (v0.3.1) - Refactor classifier-gate.yml and compile-check.yml to read version from file - Fix compile-check.yml stale v0.3.0 pin, use glob for zip download/extract - Add update-schemata.yml workflow (repository_dispatch + manual trigger) that creates PRs to bump the version when upstream schemata releases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 56 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR automates schemata-codegen version management by introducing a Changes
Sequence DiagramsequenceDiagram
actor External as Upstream Schemata
participant GHA as GitHub Actions
participant Repo as Repository
participant API as GitHub API
External->>GHA: Trigger repository_dispatch<br/>(schema-update event with tag)
activate GHA
GHA->>Repo: Read .schemata-version
Repo-->>GHA: Current version
alt Version matches requested tag
GHA->>GHA: Set SKIP=true
GHA->>GHA: Exit early (no changes needed)
else Version differs
GHA->>API: Query open PRs with<br/>chore/bump-schemata-* head
API-->>GHA: List of superseded PRs
GHA->>API: Close superseded PRs
GHA->>Repo: Create branch<br/>chore/bump-schemata-${TAG}
GHA->>Repo: Update .schemata-version<br/>with new TAG
GHA->>Repo: Commit & push changes
GHA->>API: Create PR targeting main
API-->>GHA: PR created
end
deactivate GHA
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/compile-check.yml (1)
31-38: Consider using consistent glob patterns or the version in the filename.If the asset naming is reliable (e.g.,
schemata-v0.3.1.zip), you could make the patterns more explicit:♻️ Proposed refinement for explicit naming
- name: Download schemata schemas run: | - gh release download "$SCHEMATA_VERSION" -R nostrability/schemata -p '*.zip' -D /tmp + gh release download "$SCHEMATA_VERSION" -R nostrability/schemata -p "schemata-${SCHEMATA_VERSION}.zip" -D /tmp mkdir -p /tmp/schemata-dist - unzip -q /tmp/schemata-*.zip -d /tmp/schemata-dist + unzip -q "/tmp/schemata-${SCHEMATA_VERSION}.zip" -d /tmp/schemata-dist echo "SCHEMAS_DIR=/tmp/schemata-dist" >> "$GITHUB_ENV"Alternatively, if asset names vary, use the same glob for both download and unzip:
- gh release download "$SCHEMATA_VERSION" -R nostrability/schemata -p '*.zip' -D /tmp + gh release download "$SCHEMATA_VERSION" -R nostrability/schemata -p 'schemata-*.zip' -D /tmp🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/compile-check.yml around lines 31 - 38, The download and unzip patterns differ (gh release download uses '*.zip' while unzip expects 'schemata-*.zip'), which can fail if filenames don't match; update the workflow to use a consistent asset name pattern—either make gh release download request 'schemata-*.zip' (or better: 'schemata-${SCHEMATA_VERSION}.zip' to pin the exact release file) and ensure the unzip command and subsequent SCHEMAS_DIR export use the same filename/glob so the downloaded file is found and extracted (refer to SCHEMATA_VERSION, gh release download, unzip, and SCHEMAS_DIR)..github/workflows/update-schemata.yml (1)
46-55: Consider handling pre-existing remote branches.If a previous workflow run created the branch but failed before completing (e.g., during PR creation), subsequent runs will fail at
git push. Using--force-with-leaseensures the push succeeds while protecting against unexpected concurrent changes.♻️ Proposed fix
- git push -u origin "$BRANCH" + git push --force-with-lease -u origin "$BRANCH"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/update-schemata.yml around lines 46 - 55, The Create branch and update version step currently does a plain git push which will fail if the remote branch already exists; change the push invocation that references "$BRANCH" (the git push command) to use git push --force-with-lease -u origin "$BRANCH" so the workflow can overwrite the branch created by a previous failed run while still protecting against unexpected concurrent remote changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/update-schemata.yml:
- Around line 16-24: After computing TAG and BRANCH, validate TAG is non-empty
and well-formed before writing to $GITHUB_ENV: check if TAG is empty (e.g., if [
-z "$TAG" ]) and optionally validate against a pattern (e.g., semver or allowed
chars using shell pattern or grep/egrep), and if validation fails echo a clear
error like "Missing or invalid TAG: '$TAG'" to stderr and exit 1 so the workflow
fails early; only write TAG and BRANCH to $GITHUB_ENV when the TAG passes
validation.
---
Nitpick comments:
In @.github/workflows/compile-check.yml:
- Around line 31-38: The download and unzip patterns differ (gh release download
uses '*.zip' while unzip expects 'schemata-*.zip'), which can fail if filenames
don't match; update the workflow to use a consistent asset name pattern—either
make gh release download request 'schemata-*.zip' (or better:
'schemata-${SCHEMATA_VERSION}.zip' to pin the exact release file) and ensure the
unzip command and subsequent SCHEMAS_DIR export use the same filename/glob so
the downloaded file is found and extracted (refer to SCHEMATA_VERSION, gh
release download, unzip, and SCHEMAS_DIR).
In @.github/workflows/update-schemata.yml:
- Around line 46-55: The Create branch and update version step currently does a
plain git push which will fail if the remote branch already exists; change the
push invocation that references "$BRANCH" (the git push command) to use git push
--force-with-lease -u origin "$BRANCH" so the workflow can overwrite the branch
created by a previous failed run while still protecting against unexpected
concurrent remote changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f5d5ad8f-92a2-470a-8bb4-5d7cdda3e765
📒 Files selected for processing (4)
.github/workflows/classifier-gate.yml.github/workflows/compile-check.yml.github/workflows/update-schemata.yml.schemata-version
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
.schemata-versionas single source of truth for the upstream schemata tagclassifier-gate.ymlandcompile-check.ymlto read from this file instead of hardcoding versionscompile-check.ymlstalev0.3.0pin (was alreadyv0.3.1in classifier-gate)update-schemata.ymlworkflow that auto-creates PRs when upstream schemata releasesHow it works
schematapublishes a release →notify-downstream.ymldispatchesschema-updateeventupdate-schemata.ymlreceives the event, updates.schemata-version, opens a PRSetup required
CODEGEN_PATsecret (PAT with repo scope) to this repo — see belowHow to add the CODEGEN_PAT secret
reposcopeCODEGEN_PAT, paste the tokenTest plan
.schemata-version)gh workflow run update-schemata.yml -f tag=v0.3.1Closes #23
🤖 Generated with Claude Code