ci: trigger deploy-dev workflow after sync-main-to-dev#161
Conversation
Add workflow_run trigger to deploy-dev.yaml so that it triggers when sync-main-to-dev completes successfully. This fixes the issue where pushes via GITHUB_TOKEN don't trigger other workflows. Co-Authored-By: Claude Opus 4.5 <[email protected]>
WalkthroughThe deploy-dev.yaml workflow now responds to completed "Sync main to dev" workflow runs. Conditional execution guards added to build jobs for both push and workflow_run events. Image tag computation updated to use workflow_run head_sha when available, otherwise defaults to push SHA. Ref override added for checkout in deploy job. Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/deploy-dev.yaml (1)
22-33:⚠️ Potential issue | 🟠 MajorThe build jobs check out
main's code instead ofdevinworkflow_runcontext, causing a code-to-tag mismatch.When triggered via
workflow_run,build-push-image.yamlperforms a plainactions/checkout@v4without a ref override, which defaults to the default branch (main), notdev. Meanwhile, the sync workflow usesgit merge origin/main --no-edit, which creates a merge commit ondev—makingdevHEAD different frommainHEAD after the sync completes. Images are then built frommain's code and tagged withmain's SHA (viahead_sha), while the deploy job correctly checks outdevto apply those mismatched images.To fix this,
build-push-image.yamlneeds to accept arefinput parameter, and the build jobs indeploy-dev.yamlmust passref: devwhen triggered viaworkflow_run.
🧹 Nitpick comments (1)
.github/workflows/deploy-dev.yaml (1)
10-13: Consider adding abranchesfilter toworkflow_run.Without a
branchesfilter, this trigger fires for every completion of "Sync main to dev" regardless of which branch triggered it. If that workflow only runs onmain, this is harmless but fragile — adding an explicit filter makes the intent clearer and prevents surprise triggers if the source workflow's branch rules change later.workflow_run: workflows: ["Sync main to dev"] + branches: [main] types: - completed
Summary
workflow_runtrigger todeploy-dev.yamlso it triggers whensync-main-to-devcompletes successfullyTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit