Skip to content

fix(build order): force ci to happen after docker-ci - #321

Closed
Krasner wants to merge 1 commit into
Ryan-Millard:mainfrom
Krasner:fix/ci-order
Closed

fix(build order): force ci to happen after docker-ci#321
Krasner wants to merge 1 commit into
Ryan-Millard:mainfrom
Krasner:fix/ci-order

Conversation

@Krasner

@Krasner Krasner commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

run docker-ci.yml first always, then ci.yml

What was changed & why

Fixes: #

Changes

Testing & Verification

Additional Resources

Summary by CodeRabbit

  • Chores
    • Updated internal CI/CD workflow configuration to enhance automation and testing processes.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The CI workflow is refactored from a directly-triggered workflow (via pull_request and push events) to a reusable workflow that can be invoked by other workflows. The docker-ci workflow now includes a new test job that calls this reusable ci workflow after the build job completes.

Changes

Cohort / File(s) Summary
Workflow Reusability Refactor
.github/workflows/ci.yml
Removed direct pull_request and push event triggers on main branch; added workflow_call trigger with a required ready input parameter of type string. All existing job logic remains unchanged.
Docker CI Test Integration
.github/workflows/docker-ci.yml
Added new test job that depends on the build job and invokes the reusable ci workflow from .github/workflows/ci.yml with ready: True as input.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

ci, build-system

Poem

🐰 A workflow reborn in modular grace,
No more direct triggers fill this place,
Now docker-ci calls with ready: True,
A reusable ci that workflows pursue! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: converting ci.yml to a reusable workflow callable by docker-ci.yml to enforce build order dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Krasner

Krasner commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator Author

/docker-build

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

29-51: ⚠️ Potential issue | 🔴 Critical

github.event.pull_request.number will be empty in the new call context, breaking PR image resolution.

When ci.yml was triggered by pull_request, github.event.pull_request.number was populated. Now that it's invoked via workflow_call from docker-ci.yml — whose triggering events are issue_comment, push, and pull_request: closedgithub.event.pull_request is not available for the issue_comment and push cases. In a called workflow, github.event reflects the caller's triggering event, so PR_TAG will resolve to the literal string pr- (empty number), both GHCR and DH lookups will 404, and every job will silently fall back to ghcr.io/ryan-millard/img2num-dev:main instead of the freshly built PR image — defeating the whole purpose of running CI after docker-ci.

The cleanest fix is to accept the PR number (and/or the resolved image tag) as a workflow_call input from docker-ci.yml, where it's already available via needs.guard.outputs.pr_number / needs.build.outputs.clean_core_tag.

Proposed direction

In ci.yml:

 on:
   workflow_call:
     inputs:
-      ready:
-        required: true
-        type: string
+      pr_number:
+        required: false
+        type: string
+        default: ""
+      image_tag:
+        required: false
+        type: string
+        default: ""
       - name: Set image
         id: set
         run: |
           MAIN_IMAGE="ghcr.io/ryan-millard/img2num-dev:main"
-          PR_TAG="pr-${{ github.event.pull_request.number }}"
+          PR_TAG="${{ inputs.image_tag != '' && inputs.image_tag || format('pr-{0}', inputs.pr_number) }}"

In docker-ci.yml's test job:

   test:
     needs: [guard, build]
     uses: ./.github/workflows/ci.yml
     with:
-      ready: True
+      pr_number: ${{ needs.guard.outputs.pr_number }}
+      image_tag: ${{ needs.build.outputs.clean_core_tag }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 29 - 51, The script uses
github.event.pull_request.number to build PR_TAG (and GHCR_IMAGE/DH_IMAGE) but
that field can be empty when ci.yml is invoked via workflow_call; change ci.yml
to accept a workflow_call input (e.g., pr_number and/or resolved_image_tag) and
use that input instead of github.event.pull_request.number to set PR_TAG and the
GHCR_IMAGE/DH_IMAGE fallbacks, then update the caller (docker-ci.yml) to pass
needs.guard.outputs.pr_number or needs.build.outputs.clean_core_tag into those
inputs so PR image resolution works in called workflows.
🤖 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/ci.yml:
- Around line 3-13: Restore automatic PR and main push triggers by re-adding
pull_request (opened, synchronize, reopened) and push: branches: [main] to this
workflow's on: section instead of making it callable-only; remove the
commented-out on: block entirely; if you must keep workflow_call, also add
pull_request/push triggers so PRs run automatically. Remove the unused workflow
input named ready (and delete the corresponding with: { ready: True } usage in
docker-ci.yml). Alternatively, keep this workflow callable-only but update
docker-ci.yml to trigger on pull_request events (opened/synchronize/reopened) or
make the set-image job wait/depend on the image publish step so tests can run
automatically—adjust the set-image job dependency if chosen.

---

Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 29-51: The script uses github.event.pull_request.number to build
PR_TAG (and GHCR_IMAGE/DH_IMAGE) but that field can be empty when ci.yml is
invoked via workflow_call; change ci.yml to accept a workflow_call input (e.g.,
pr_number and/or resolved_image_tag) and use that input instead of
github.event.pull_request.number to set PR_TAG and the GHCR_IMAGE/DH_IMAGE
fallbacks, then update the caller (docker-ci.yml) to pass
needs.guard.outputs.pr_number or needs.build.outputs.clean_core_tag into those
inputs so PR image resolution works in called workflows.
🪄 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: 169dfeb4-9abe-43b9-a183-ee36ece4a774

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad4c93 and 36d06fc.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/docker-ci.yml

Comment thread .github/workflows/ci.yml
Comment on lines +3 to +13
# on:
# pull_request:
# branches: [main]
# push:
# branches: [main]
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_call:
inputs:
ready:
required: true
type: string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# List GitHub workflows to understand the structure
ls -la .github/workflows/

Repository: Ryan-Millard/Img2Num

Length of output: 963


🏁 Script executed:

#!/bin/bash
# Read the ci.yml file to verify the current state
cat -n .github/workflows/ci.yml

Repository: Ryan-Millard/Img2Num

Length of output: 3747


🏁 Script executed:

#!/bin/bash
# Read the docker-ci.yml file to verify trigger conditions
cat -n .github/workflows/docker-ci.yml

Repository: Ryan-Millard/Img2Num

Length of output: 12803


🏁 Script executed:

#!/bin/bash
# Search for references to the 'ready' input throughout the workflows
rg "ready" .github/workflows/

Repository: Ryan-Millard/Img2Num

Length of output: 151


Regression confirmed: PRs no longer receive automatic CI on open/synchronize.

By removing pull_request/push triggers and making this workflow callable-only, CI now runs only when docker-ci.yml's test job invokes it. docker-ci.yml itself triggers on issue_comment, push (main/tags), and pull_request: closed — none of which fire when a contributor opens or updates a PR. The net effect is that lint, C/C++ build, React build, and docs build will not run on a PR until a maintainer manually comments /docker-build <sha>. For external contributors and normal PR review, this means no CI coverage by default, which is a meaningful quality-gate regression versus the previous behavior.

If the goal is simply "ensure the docker image is built before CI runs against it" (per the PR title), consider instead keeping pull_request triggers here but having the set-image job wait for / depend on the image publish, or gate individual jobs on image availability rather than disabling automatic triggers entirely. Alternatively, have docker-ci.yml also trigger on pull_request: [opened, synchronize, reopened] so the full guard → build → test chain runs automatically.

Additionally:

  • The commented-out on: block (Lines 3–7) should be deleted rather than left as comments.
  • ready is declared required: true but is never referenced in any job in this file — it's a dead input. Drop it (and the with: { ready: True } in docker-ci.yml).

Please confirm whether losing automatic PR CI (and CI on push to main) is intentional. If yes, please also confirm how main-branch regressions will be caught before release.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 3 - 13, Restore automatic PR and main
push triggers by re-adding pull_request (opened, synchronize, reopened) and
push: branches: [main] to this workflow's on: section instead of making it
callable-only; remove the commented-out on: block entirely; if you must keep
workflow_call, also add pull_request/push triggers so PRs run automatically.
Remove the unused workflow input named ready (and delete the corresponding with:
{ ready: True } usage in docker-ci.yml). Alternatively, keep this workflow
callable-only but update docker-ci.yml to trigger on pull_request events
(opened/synchronize/reopened) or make the set-image job wait/depend on the image
publish step so tests can run automatically—adjust the set-image job dependency
if chosen.

@Krasner

Krasner commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator Author

/docker-build 36d06fc

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker image built successfully!

Image

ghcr.io/ryan-millard/img2num-dev:pr-321

Run it locally:

IMG2NUM_IMAGE=ghcr.io/ryan-millard/img2num-dev:pr-321 ./img2num sh

@Krasner Krasner closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant