fix(build-go-attest): capture git show failure before set -e aborts#79
Merged
fix(build-go-attest): capture git show failure before set -e aborts#79
Conversation
Copilot review on #78: 1. 'BUILD_TS=$(git show …)' under 'set -euo pipefail' aborts the script on git-show failure BEFORE the custom ::error:: diagnostic runs. Wrap in 'if ! BUILD_TS=$(...); then' so the non-zero exit is captured locally; stderr now merged into stdout via '2>&1' so the actual git error message appears in the annotation. 2. The error text claimed fetch-depth>=1 was required, but actions/checkout's fetch-depth: 0 (full history) also produces a valid HEAD. Reword to 'fetch-depth 0 or >=1 both work'. Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
This PR updates the reusable build-go-attest workflow to ensure auto-build-timestamp failures are surfaced with a custom GitHub Actions ::error:: annotation even under set -euo pipefail, and refines the guidance text around checkout history requirements.
Changes:
- Wrap
git show -s --format=%cI HEADin an explicit failure-checkingif ! ...; then ... exit 1block to avoidset -eshort-circuiting the custom diagnostic. - Reword the “empty build timestamp” error message to clarify that
fetch-depth: 0andfetch-depth >= 1both produce a validHEAD.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CybotTM
added a commit
that referenced
this pull request
Apr 21, 2026
Copilot on [#79](#79): merging stderr into stdout via `2>&1` meant that if `git show` exited 0 with a warning on stderr, `BUILD_TS` would contain that warning text — the empty-string check would still pass, and the ldflag would assemble with a non-timestamp value, breaking `go build` or shipping corrupted metadata. Drop the merge. `BUILD_TS` captures stdout only; git's stderr flows to the Actions step log naturally. The `::error::` annotation points users at 'the git error above' instead of inlining a potentially corrupted string.
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.
Copilot on #78:
set -eshort-circuit:BUILD_TS=$(git show …)underset -euo pipefailaborts before the custom::error::diagnostic runs. Wrap inif ! BUILD_TS=$(...); thenso the non-zero exit is captured locally; merge stderr into stdout (2>&1) so git's actual error message appears in the annotation.fetch-depth: 0also produces a valid HEAD. Reword to 'fetch-depth 0 or >=1 both work'.