ci: make the main-image dispatch repo and ref configurable#3883
Conversation
The dispatch-main-image gate was hardcoded to triggerdotdev/trigger.dev on the main ref. Make both overridable via the MAIN_IMAGE_DISPATCH_REPO and MAIN_IMAGE_DISPATCH_REF_PREFIX repository variables, each defaulting to the current value so behaviour is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
WalkthroughThis PR updates the GitHub Actions publish workflow to make the dispatch-main-image job's trigger condition configurable. The job now checks github.repository against vars.MAIN_IMAGE_DISPATCH_REPO (defaulting to triggerdotdev/trigger.dev), requires github.event_name == 'push', and uses startsWith(github.ref_name, vars.MAIN_IMAGE_DISPATCH_REF_PREFIX || 'main') instead of comparing a published version output. The repository-dispatch action's repository input is now vars.MAIN_IMAGE_DISPATCH_TARGET (defaulting to triggerdotdev/cloud). 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/plugins
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
Addresses review feedback: - The startsWith(github.ref_name, ...) gate would fire during release builds: release.yml invokes publish.yml via workflow_call with an explicit image_tag while github.ref_name is still `main`, so the job ran without CROSS_REPO_PAT and failed the release pipeline. Gate on github.event_name == 'push' — the intended paths (push to main, push of build-* tags) are push events; the release path is pull_request/workflow_dispatch. A version-equality check can't be used because build-* tags strip the prefix to the version output. - Make the dispatch target overridable via MAIN_IMAGE_DISPATCH_TARGET, defaulting to triggerdotdev/cloud. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The
dispatch-main-imagejob was hard-gated totriggerdotdev/trigger.devon themainref. This makes it configurable via repository variables, all defaulting to the current values:MAIN_IMAGE_DISPATCH_REPO— the repo allowed to dispatch (defaulttriggerdotdev/trigger.dev).MAIN_IMAGE_DISPATCH_REF_PREFIX— the ref-name prefix that dispatches, matched withstartsWith(github.ref_name, …)(defaultmain).MAIN_IMAGE_DISPATCH_TARGET— therepository_dispatchtarget (defaulttriggerdotdev/cloud).The job is additionally gated on
github.event_name == 'push'. This is necessary, not just defensive: the gate now keys offgithub.ref_namerather than the computed image tag, andref_nameis stillmainwhenrelease.ymlinvokes this workflow viaworkflow_callduring a release — so without the event guard the job would fire during every release and fail on the absentCROSS_REPO_PAT. A version-equality check can't replace it becausebuild-*tags strip the prefix to the version output.Behaviour note: the intended dispatch paths — push to
main, and push of a<prefix>*tag in a downstream repo — arepushevents and are unchanged. The one case that no longer dispatches is a manualworkflow_dispatchrun ofpublish.ymlonmain(it previously did, via the oldversion == 'main'check). That path is indistinguishable from a manual release by event name, sopush-only is the clean discriminator.Dispatching still requires
CROSS_REPO_PAT, so setting the variables alone doesn't enable anything.