[#1046] Read the latest release with the workflow token, and fail the step when it comes back empty - #1047
Merged
vharseko merged 1 commit intoSep 15, 2026
Conversation
… token, and fail the step when it comes back empty The build-docker and build-docker-alpine jobs tag the image they test with the name of the latest release, read from the GitHub API with an anonymous curl. The anonymous limit is 60 requests an hour per source address and is shared by every job the address hosts; once it is spent the answer carries no release, the version is empty, docker/metadata-action produces no tag and buildx refuses the push with "tag is needed when pushing to registry" - a red leg with no relation to the change under test (run 34854564649, attempt 1). The step now sends the workflow token, which has a budget of its own, and stops with a named error when the version is still empty, so the next failure of this shape is reported at the step which caused it rather than at the push.
maximthomas
approved these changes
Sep 15, 2026
This was referenced Sep 15, 2026
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.
Fixes #1046
What fails
Run 34854564649 (#968), job
build-docker: the step «Get latest release version» printedlast release:with nothing after it,docker/metadata-actionwarned «No Docker image version has been generated», and the push failed withERROR: failed to build: tag is needed when pushing to registry. The maven legs of the run were green and attempt 2 passed with no change to the branch.The step reads
api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latestwith an anonymouscurl. The anonymous limit is 60 requests an hour per source address and is shared by every job the runner's address hosts; a rate-limited answer carries no"name", so the version is empty and the image has no tag.build-docker-alpinereads the release the same way.The change
.github/workflows/build.yml, the «Get latest release version» step ofbuild-dockerandbuild-docker-alpine:GH_TOKEN: ${{ github.token }}throughenv:— the shape the Windows-artifact wait already uses — and thecurlsends it asAuthorization: Bearer. The workflow token has a budget of its own;permissions: contents: read, which both jobs already declare, is enough to read the releases of a public repository, from a fork's read-only PR token included;::error::The latest release of OpenIdentityPlatform/OpenDJ could not be read, so there is no version to tag the image withand exit 1, so the next failure of this shape is reported at the step which caused it rather than at the push.The read itself (
curl -i | grep "name" | cut) and everything after it are as they were.Checked
envand the newrun.GH_TOKEN:last release: 5.1.2, the guard passes. The header is honoured: the authenticated call answersx-ratelimit-limit: 5000, the anonymous one60.::errorand exits 1.build-dockerandbuild-docker-alpinelegs of this PR's own run exercise the step on a runner.