ci: only build a release candidate when a release will actually happen - #6
Merged
Merged
Conversation
Every push to main built and tested the image, including infra-only merges that release nothing — the App-token merge earlier today spent a full build to publish nothing at all. Path filtering cannot decide this: a releasing commit touching only docs would skip the build and leave the publish step with no image. The release decision is what matters, so semantic-release is asked in dry-run first and the build is guarded on its answer. The build still precedes the real release, so a broken image can never be published. Unlike plcc-ng-devcontainer this workflow is a single job, so the guard is on steps rather than a separate build job. Guarded with != 'false' so an unexpected or empty output still builds: skipping a needed build breaks publishing, an extra build only costs time. Also fails loudly if the dry run and the real release ever disagree. Without that the failure would be silent and wrong: with no image built, the publish step's `FROM ...:latest` would pull the previous release's image and push it under the new version tags. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the main-branch release workflow to avoid building the devcontainer image unless semantic-release indicates that the current commit will produce a release, reducing wasted build time on non-releasing merges.
Changes:
- Adds a semantic-release dry run step to determine whether a release is planned.
- Guards GHCR login and the devcontainer build/test step based on the dry-run result.
- Adds a safety check intended to fail if the dry run and the real release disagree.
Comments suppressed due to low confidence (2)
.github/workflows/release.yml:74
- Same guard issue as the GHCR login step: with
!= 'false', an unset/emptynew_release_publishedoutput will cause the image build to run even when semantic-release indicates there is no release. Using an explicit== 'true'check (with a failure fallback) should allow infra-only/no-release merges to skip the expensive build.
- name: Build and test devcontainer image
if: steps.plan.outputs.new_release_published != 'false'
uses: devcontainers/ci@v0.3
.github/workflows/release.yml:93
- This mismatch check is currently looking for
steps.plan.outputs.new_release_published == 'false', but the dry-run action commonly leaves the output unset when no release happens (instead of emitting'false'). That means this safeguard may never trigger in the mismatch scenario it is meant to catch.
Consider treating anything other than an explicit 'true' (with a successful dry-run outcome) as “predicted no release”.
- name: Fail if the dry run and the real release disagreed
if: steps.semantic.outputs.new_release_published == 'true' && steps.plan.outputs.new_release_published == 'false'
run: |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
64
to
66
| - name: Log in to GHCR | ||
| if: steps.plan.outputs.new_release_published != 'false' | ||
| uses: docker/login-action@v3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every push to main built and tested the image, including infra-only merges that release nothing — the App-token merge earlier today spent a full build to publish nothing at all.
Path filtering cannot decide this: a releasing commit touching only docs would skip the build and leave the publish step with no image. The release decision is what matters, so semantic-release is asked in dry-run first and the build is guarded on its answer. The build still precedes the real release, so a broken image can never be published.
Unlike plcc-ng-devcontainer this workflow is a single job, so the guard is on steps rather than a separate build job.
Guarded with != 'false' so an unexpected or empty output still builds: skipping a needed build breaks publishing, an extra build only costs time.
Also fails loudly if the dry run and the real release ever disagree. Without that the failure would be silent and wrong: with no image built, the publish step's
FROM ...:latestwould pull the previous release's image and push it under the new version tags.