Conversation
WalkthroughModified GitHub Actions workflow to support workflow_run trigger events. Added conditional logic to the build-server job execution, updated image tagging to use appropriate commit SHA based on trigger type (push or workflow_run), and adjusted checkout reference handling for workflow_run events. Changes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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: 2
🧹 Nitpick comments (1)
.github/workflows/deploy-dev.yaml (1)
33-33: Deduplicate SHA/tag expression to avoid drift.The same conditional SHA logic appears in Line 33 and Line 57. Centralize it in a single env variable so build/deploy tagging can’t diverge later.
Refactor sketch
env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} NS: agent + DEPLOY_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} @@ - tag: dev-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} + tag: dev-${{ env.DEPLOY_SHA }} @@ - TAG="dev-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" + TAG="dev-${{ env.DEPLOY_SHA }}"Also applies to: 57-57
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/deploy-dev.yaml at line 33, Create a single reusable environment variable (e.g., DEPLOY_TAG or TAG_SHA) at the workflow or job level and assign it the conditional expression currently used in the tag field (the dev-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} expression); then replace both occurrences of the inline tag expression (the "tag: dev-${{ ... }}" usage) with a reference to that env variable so both build and deploy use the exact same computed tag value.
🤖 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/deploy-dev.yaml:
- Around line 10-13: The workflow_run trigger is currently unscoped and will
fire for any completed run of "Sync main to dev"; update the workflow_run block
to include a branches filter (e.g., branches: ["main"]) so it only triggers when
the upstream workflow ran on the intended upstream branch; modify the
workflow_run stanza (the keys workflow_run and workflows: ["Sync main to dev"])
to add a branches entry constraining runs to "main".
- Around line 46-47: Replace the mutable checkout ref with an immutable commit
SHA: update the checkout step's with.ref expression (the "ref" key in the
checkout step) to use github.sha for push events and
github.event.workflow_run.head_sha for workflow_run events so the checked-out
code matches the image tag; i.e., change the conditional that currently selects
github.ref or 'dev' to select github.sha when github.event_name == 'push' and
github.event.workflow_run.head_sha when github.event_name == 'workflow_run'.
---
Nitpick comments:
In @.github/workflows/deploy-dev.yaml:
- Line 33: Create a single reusable environment variable (e.g., DEPLOY_TAG or
TAG_SHA) at the workflow or job level and assign it the conditional expression
currently used in the tag field (the dev-${{ github.event_name == 'workflow_run'
&& github.event.workflow_run.head_sha || github.sha }} expression); then replace
both occurrences of the inline tag expression (the "tag: dev-${{ ... }}" usage)
with a reference to that env variable so both build and deploy use the exact
same computed tag value.
Summary by CodeRabbit