fix(release): dispatch deploy/dist workflows after sync-main push - #320
Conversation
GITHUB_TOKEN pushes do not emit push events, so deploy-configurator.yml and publish-dist.yml were never triggered by the sync-main commit. This caused the configurator and CDN bundles to always show the previous release version rather than the newly released one. Fix: after a successful push to main, explicitly dispatch both downstream workflows via the workflow_dispatch API, which GITHUB_TOKEN is permitted to trigger. https://claude.ai/code/session_01N4PS78g7vyvyQwyzivoiuu
|
Warning Review limit reached
More reviews will be available in 46 minutes and 47 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe release workflow now detects when version artifacts are pushed during the sync-main job and explicitly dispatches downstream workflows via the GitHub Actions API, since pushes made with GITHUB_TOKEN do not trigger push-based workflow events. ChangesExplicit downstream workflow dispatch
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 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 (1)
.github/workflows/release.yml (1)
206-217: ⚡ Quick winConsider using the GitHub CLI instead of curl for clearer error messages.
The current
curlapproach is functional, but the GitHub CLI (gh) is pre-installed on ubuntu-latest runners and provides simpler syntax with better error messages. The current implementation will fail fast if the first workflow dispatch fails (due tocurl -f), preventing the second dispatch from running.♻️ Alternative implementation using gh CLI
- name: Trigger downstream deploys if: steps.commit_push.outputs.pushed == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # GITHUB_TOKEN pushes do not emit push events, so deploy-configurator # and publish-dist would never see the new version. Dispatch them # explicitly — GITHUB_TOKEN CAN trigger workflow_dispatch events. - for wf in deploy-configurator.yml publish-dist.yml; do - curl -sS -f -X POST \ - -H "Authorization: Bearer ${GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows/${wf}/dispatches" \ - -d '{"ref":"main"}' - echo "Dispatched ${wf}" - done + gh workflow run deploy-configurator.yml --ref main + echo "Dispatched deploy-configurator.yml" + gh workflow run publish-dist.yml --ref main + echo "Dispatched publish-dist.yml"Benefits:
- Simpler syntax
- Better error messages if dispatch fails
- More idiomatic for GitHub Actions
- Each dispatch is independent (one failure won't prevent the other)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/release.yml around lines 206 - 217, Replace the curl-based dispatch loop with gh CLI calls: in the existing loop that iterates over deploy-configurator.yml and publish-dist.yml (the block containing the curl -X POST ... "dispatches" invocation), call gh workflow run "$wf" --ref main (or gh workflow run <workflow_file> --ref main) for each workflow instead of curl, echo the result, and ensure each gh invocation is run independently so a failure in one does not prevent the next (e.g., do not set -e for the loop or append || true to each call if needed). This removes the manual Authorization headers and leverages the pre-installed gh for clearer error messages and simpler syntax.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 202-217: The sync-main job’s GITHUB_TOKEN lacks actions: write so
the REST workflow_dispatch calls in the "Trigger downstream deploys" step can
403; add permissions: actions: write (either at the workflow level or inside the
sync-main job) so the token can dispatch workflows, and optionally change the
curl invocation (remove -f or handle per-workflow errors in the loop) so a
single failed dispatch doesn’t stop the remaining dispatches.
---
Nitpick comments:
In @.github/workflows/release.yml:
- Around line 206-217: Replace the curl-based dispatch loop with gh CLI calls:
in the existing loop that iterates over deploy-configurator.yml and
publish-dist.yml (the block containing the curl -X POST ... "dispatches"
invocation), call gh workflow run "$wf" --ref main (or gh workflow run
<workflow_file> --ref main) for each workflow instead of curl, echo the result,
and ensure each gh invocation is run independently so a failure in one does not
prevent the next (e.g., do not set -e for the loop or append || true to each
call if needed). This removes the manual Authorization headers and leverages the
pre-installed gh for clearer error messages and simpler syntax.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a2422a65-5387-4151-a7a2-1e680e126b40
📒 Files selected for processing (1)
.github/workflows/release.yml
- Add `actions: write` to sync-main job permissions so GITHUB_TOKEN is authorised to call the workflow_dispatch REST endpoint (without it the curl/gh call returns 403). - Replace curl loop with two independent `gh workflow run` calls: each dispatch is its own statement so a failure in one does not abort the other, and gh provides clearer error messages than raw curl. https://claude.ai/code/session_01N4PS78g7vyvyQwyzivoiuu
GITHUB_TOKEN pushes do not emit push events, so deploy-configurator.yml
and publish-dist.yml were never triggered by the sync-main commit.
This caused the configurator and CDN bundles to always show the previous
release version rather than the newly released one.
Fix: after a successful push to main, explicitly dispatch both downstream
workflows via the workflow_dispatch API, which GITHUB_TOKEN is permitted
to trigger.
https://claude.ai/code/session_01N4PS78g7vyvyQwyzivoiuu
Summary by CodeRabbit