Skip to content

ci: skip the image build when a change cannot affect the image - #4

Merged
StoneyJackson merged 2 commits into
mainfrom
ci/skip-build-when-image-unchanged
Jul 27, 2026
Merged

ci: skip the image build when a change cannot affect the image#4
StoneyJackson merged 2 commits into
mainfrom
ci/skip-build-when-image-unchanged

Conversation

@StoneyJackson

Copy link
Copy Markdown
Member

Every PR rebuilt and pushed the devcontainer image regardless of what it touched — the App-token PR is doing exactly that right now for a change confined to release workflows.

A cheap changes job classifies the diff and the expensive steps are guarded on it. The jobs themselves still run and still post their checks: skipping a job leaves its required check unreported, which is the failure this repo spent today stuck in.

ci-gate now also gates on changes, so a failure there blocks rather than silently skipping the build.

Every PR rebuilt and pushed the devcontainer image regardless of what it
touched — the App-token PR is doing exactly that right now for a change
confined to release workflows.

A cheap `changes` job classifies the diff and the expensive steps are
guarded on it. The jobs themselves still run and still post their checks:
skipping a job leaves its required check unreported, which is the failure
this repo spent today stuck in.

ci-gate now also gates on `changes`, so a failure there blocks rather than
silently skipping the build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 18:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the CI workflow by detecting whether a PR’s file changes can impact the devcontainer image, and only running the expensive image build/push steps when necessary—while still ensuring required checks are always reported via ci-gate.

Changes:

  • Add a changes job that classifies whether the devcontainer image could be affected (based on a base..head diff).
  • Guard the checkout/login/build/push/comment steps in build behind needs.changes.outputs.image == 'true' so the build job still reports a check but avoids expensive work when irrelevant.
  • Update ci-gate to depend on both changes and build, and to fail unless all required jobs conclude success.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines 105 to 108
- name: Comment image tag on PR
# No image was built, so there is no tag to advertise.
if: needs.changes.outputs.image == 'true'
uses: actions/github-script@v7
Pushing a follow-up commit to an open PR left the previous run building
and pushing the image to completion, so a branch could have two full
image pushes to the same GHCR package in flight at once.

Only the newest commit's result gates the merge, so the older run is
cancelled. Scoped per PR, so runs on different PRs never cancel each other.
Matches plcc-ng-devcontainer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🐳 PR image built: ghcr.io/ourplcc/plcc-devcontainer:pr-4

To test manually, update .devcontainer/devcontainer.json to use this image tag.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🐳 PR image built: ghcr.io/ourplcc/plcc-devcontainer:pr-4

To test manually, update .devcontainer/devcontainer.json to use this image tag.

@StoneyJackson
StoneyJackson merged commit b6e8a41 into main Jul 27, 2026
3 checks passed
@StoneyJackson
StoneyJackson deleted the ci/skip-build-when-image-unchanged branch July 27, 2026 18:21
@ourplcc-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants