[#556] Improve Workflow by Adding Initial Danger Job#695
[#556] Improve Workflow by Adding Initial Danger Job#695thinh2k1310 wants to merge 1 commit intodevelopfrom
Conversation
📝 WalkthroughWalkthroughThe CI workflow is split into two jobs: Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant GH as GitHub Actions
participant Setup as ./ .github/actions/setup-ci-environment
participant DangerEarly as Danger (EarlyDangerfile)
participant Checkout as actions/checkout
participant Cache as Cache
participant Build as Build/Test (arkana/fastlane)
participant DangerPost as Danger (Dangerfile)
Dev->>GH: Push PR / open PR
GH->>Setup: early_review -> setup CI env
Setup-->>GH: CI env ready
GH->>DangerEarly: run bundle exec danger --dangerfile=template/EarlyDangerfile
DangerEarly-->>GH: early feedback (warnings/errors)
GH->>Checkout: build_and_test (needs: early_review) -> full checkout
GH->>Cache: restore vendor/bundle
GH->>Setup: setup CI env
Setup-->>GH: CI env ready
GH->>Build: run build & tests (arkana / fastlane)
Build-->>GH: build/test results, artifacts
GH->>DangerPost: run bundle exec danger (post-build)
DangerPost-->>GH: post-build PR review comments
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml (1)
62-71:⚠️ Potential issue | 🟡 MinorRemove the redundant
Bundle installstep — it duplicatessetup-ci-environment.
setup-ci-environmentat lines 56‑60 already executesbundle config set --local path 'vendor/bundle' && bundle installvia itsbundle-install-commandinput (see.cicdtemplate/.github/actions/setup-ci-environment/action.ymllines 43‑47). Running it again here is wasted time on every PR and is inconsistent with the GitHub-hosted workflow, which correctly omits this step.🔧 Proposed fix
- name: Setup ENV file env: ENV: ${{ secrets.ENV }} run: | touch .env echo $ENV | base64 --decode > .env - - name: Bundle install - run: bundle config set --local path 'vendor/bundle' && bundle install - - name: Run Arkana run: bundle exec arkana🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml around lines 62 - 71, Remove the redundant "Bundle install" step from the workflow: delete the job step whose name is "Bundle install" (the one running "bundle config set --local path 'vendor/bundle' && bundle install") because setup-ci-environment already runs bundler via its bundle-install-command input; keep the preceding "Setup ENV file" step and rely on the existing setup-ci-environment action instead of duplicating bundler installation.
🧹 Nitpick comments (2)
.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml (1)
39-60: Same DRY opportunity as the hosted workflow.The checkout + cache +
setup-ci-environmentprelude is duplicated acrossearly_reviewandbuild_and_test. Consider sharing it via a composite action or reusable workflow alongside the equivalent change in.cicdtemplate/.github/workflows/automatic_pull_request_review.ymlto keep both variants in sync.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml around lines 39 - 60, The checkout + cache + setup sequence is duplicated between the early_review and build_and_test jobs (the actions/checkout step, actions/cache with id bundlerCache, and the "Setup CI environment" step that uses ./.github/actions/setup-ci-environment); extract these shared steps into a single reusable unit (either a composite action or a reusable workflow) and replace the duplicated blocks in both jobs with a call to that new reusable action/workflow, ensuring the bundle-install-command and bundler-cache inputs are forwarded so behavior remains identical; also update .cicdtemplate/.github/workflows/automatic_pull_request_review.yml to use the same reusable unit so hosted and self-hosted variants stay in sync..cicdtemplate/.github/workflows/automatic_pull_request_review.yml (1)
12-60: Optional: reduce duplication betweenearly_reviewandbuild_and_test.Both jobs repeat the same checkout, Bundler cache, and
setup-ci-environmentblock. Consider wrapping the shared prelude in a small composite action (e.g.,./.github/actions/prepare-danger-env) or reusable workflow so any future change (pinning, cache key, input) only needs to happen in one place. Keeping the two jobs separate is still fine since they run sequentially vianeeds:— this is a maintainability nit, not a blocker.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.cicdtemplate/.github/workflows/automatic_pull_request_review.yml around lines 12 - 60, The two jobs early_review and build_and_test duplicate the same checkout, actions/cache, and uses: ./.github/actions/setup-ci-environment steps; extract those shared steps into a small composite action (e.g., ./.github/actions/prepare-ci or a reusable workflow) that performs the checkout, Bundler cache setup, and calls the existing setup-ci-environment inputs, then replace the duplicated blocks in both early_review and build_and_test with a single step that calls the new composite action so future changes to checkout, cache keys, or bundle-install-command are made in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
@.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml:
- Around line 62-71: Remove the redundant "Bundle install" step from the
workflow: delete the job step whose name is "Bundle install" (the one running
"bundle config set --local path 'vendor/bundle' && bundle install") because
setup-ci-environment already runs bundler via its bundle-install-command input;
keep the preceding "Setup ENV file" step and rely on the existing
setup-ci-environment action instead of duplicating bundler installation.
---
Nitpick comments:
In
@.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml:
- Around line 39-60: The checkout + cache + setup sequence is duplicated between
the early_review and build_and_test jobs (the actions/checkout step,
actions/cache with id bundlerCache, and the "Setup CI environment" step that
uses ./.github/actions/setup-ci-environment); extract these shared steps into a
single reusable unit (either a composite action or a reusable workflow) and
replace the duplicated blocks in both jobs with a call to that new reusable
action/workflow, ensuring the bundle-install-command and bundler-cache inputs
are forwarded so behavior remains identical; also update
.cicdtemplate/.github/workflows/automatic_pull_request_review.yml to use the
same reusable unit so hosted and self-hosted variants stay in sync.
In @.cicdtemplate/.github/workflows/automatic_pull_request_review.yml:
- Around line 12-60: The two jobs early_review and build_and_test duplicate the
same checkout, actions/cache, and uses: ./.github/actions/setup-ci-environment
steps; extract those shared steps into a small composite action (e.g.,
./.github/actions/prepare-ci or a reusable workflow) that performs the checkout,
Bundler cache setup, and calls the existing setup-ci-environment inputs, then
replace the duplicated blocks in both early_review and build_and_test with a
single step that calls the new composite action so future changes to checkout,
cache keys, or bundle-install-command are made in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c2e95732-59cf-4357-a17f-0bedbf950fd4
📒 Files selected for processing (4)
.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml.cicdtemplate/.github/workflows/automatic_pull_request_review.ymltemplate/Dangerfiletemplate/EarlyDangerfile
87c8da6 to
cb0049f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml (2)
12-13: Job name and step name collide.The job name on line 13 (
Early PR review by Danger) is identical to the step name on line 34. In the GitHub Actions UI this renders asEarly PR review by Danger / Early PR review by Danger, which is visually confusing. Consider renaming the job to something action-oriented (matchingbuild_and_teststyle) or dropping the step name so the run step inherits its command.♻️ Proposed fix
early_review: - name: Early PR review by Danger + name: Early review runs-on: [self-hosted, macOS]Also applies to: 34-34
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml around lines 12 - 13, The job name "early_review" currently sets the UI job display to "Early PR review by Danger" which duplicates the step name "Early PR review by Danger"; to fix, change the job's display name or the step name so they don't collide—either rename the job display to an action-oriented identifier (e.g., change the name value under the early_review job from "Early PR review by Danger" to something like "run_early_review" or "early_pr_review") or remove/rename the step's name so the run step inherits its command; update the YAML entry for the early_review job and the step that currently uses the same literal to ensure unique, non-duplicated display strings.
56-70: Redundantbundle install— Setup CI environment already runs it.The
Setup CI environmentcomposite action at lines 56–60 is invoked withbundler-cache: "false"and an explicitbundle-install-command, so (per the action'srun-bundle-installdefault of"true") it will already executebundle config set --local path 'vendor/bundle' && bundle install. The standaloneBundle installstep at lines 69–70 re-runs the exact same command on a self-hosted macOS runner, wasting CI time with no functional gain.The same pattern exists in the new
early_reviewjob (lines 28–32) and doesn't have a duplicate step there, confirming the inconsistency.♻️ Proposed fix — drop the duplicate step
- - name: Bundle install - run: bundle config set --local path 'vendor/bundle' && bundle install - - name: Run Arkana run: bundle exec arkana🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml around lines 56 - 70, Remove the redundant standalone "Bundle install" step that repeats the bundle install command already executed by the "Setup CI environment" composite action (invoked with bundler-cache: "false" and bundle-install-command), and likewise remove any duplicate bundle install step in the early_review job to avoid re-running the same command; locate the steps named "Setup CI environment" and "Bundle install" in the workflow and delete the explicit "Bundle install" step(s) so the composite action handles installation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
@.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml:
- Line 48: The two jobs use different pins for actions/cache causing
inconsistency; update the uses:
actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 in this job to match the
same commit used by the early_review job (the actions/cache commit starting with
27d5ce7… labeled v5.0.5) so both jobs pin the identical actions/cache revision;
locate the uses: actions/cache entry in this job and replace its commit SHA with
the same SHA used in the early_review job to ensure consistent caching behavior
and supply-chain guarantees.
---
Nitpick comments:
In
@.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml:
- Around line 12-13: The job name "early_review" currently sets the UI job
display to "Early PR review by Danger" which duplicates the step name "Early PR
review by Danger"; to fix, change the job's display name or the step name so
they don't collide—either rename the job display to an action-oriented
identifier (e.g., change the name value under the early_review job from "Early
PR review by Danger" to something like "run_early_review" or "early_pr_review")
or remove/rename the step's name so the run step inherits its command; update
the YAML entry for the early_review job and the step that currently uses the
same literal to ensure unique, non-duplicated display strings.
- Around line 56-70: Remove the redundant standalone "Bundle install" step that
repeats the bundle install command already executed by the "Setup CI
environment" composite action (invoked with bundler-cache: "false" and
bundle-install-command), and likewise remove any duplicate bundle install step
in the early_review job to avoid re-running the same command; locate the steps
named "Setup CI environment" and "Bundle install" in the workflow and delete the
explicit "Bundle install" step(s) so the composite action handles installation.
🪄 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: abcd5611-ca1d-47be-a418-0427236c5e4f
📒 Files selected for processing (4)
.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml.cicdtemplate/.github/workflows/automatic_pull_request_review.ymltemplate/Dangerfiletemplate/EarlyDangerfile
✅ Files skipped from review due to trivial changes (1)
- template/EarlyDangerfile
🚧 Files skipped from review as they are similar to previous changes (2)
- template/Dangerfile
- .cicdtemplate/.github/workflows/automatic_pull_request_review.yml
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # actions/cache@v5.0.4 |
There was a problem hiding this comment.
Inconsistent actions/cache pin between jobs.
The early_review job pins actions/cache to 27d5ce7… (labeled v5.0.5 on line 20), while this job pins it to 668228422… (labeled v5.0.4). Use the same version across both jobs to keep cache behavior and supply-chain guarantees consistent, and to avoid confusion when bumping versions later.
♻️ Proposed fix
- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # actions/cache@v5.0.4
+ - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # actions/cache@v5.0.5📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # actions/cache@v5.0.4 | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # actions/cache@v5.0.5 |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
@.cicdtemplate/.github/self-hosted-workflows/automatic_pull_request_review.yml
at line 48, The two jobs use different pins for actions/cache causing
inconsistency; update the uses:
actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 in this job to match the
same commit used by the early_review job (the actions/cache commit starting with
27d5ce7… labeled v5.0.5) so both jobs pin the identical actions/cache revision;
locate the uses: actions/cache entry in this job and replace its commit SHA with
the same SHA used in the early_review job to ensure consistent caching behavior
and supply-chain guarantees.
What happened 👀
EarlyDangerfile.early_reviewjob at the initial ofautomatic_pull_request_reviewworkflow.Insight 📝
N/A
Proof Of Work 📹
Summary by CodeRabbit