Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/build-go-attest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,15 @@ jobs:
# fails hard if resolution yields an empty string so opting in
# can't silently ship a binary with an empty buildTime.
if [[ "${AUTO_BUILD_TIMESTAMP}" == "true" ]]; then
# Capture both success/failure explicitly — `set -e` would
# otherwise abort on a non-zero `git show` before the custom
# diagnostic runs. The empty-string check still fires for
# exit-0-empty-output edge cases.
if ! BUILD_TS=$(git show -s --format=%cI HEAD 2>&1); then
echo "::error::auto-build-timestamp=true but 'git show -s --format=%cI HEAD' failed: ${BUILD_TS}. Check that actions/checkout completed and HEAD points at a real commit."
# Capture success/failure explicitly — `set -e` would otherwise
# abort on a non-zero `git show` before the custom diagnostic
# runs. Stderr intentionally NOT merged into BUILD_TS so a
# warning on stderr (exit 0) can't corrupt the ldflag value;
# git's own error message still surfaces through the Actions
# step log naturally. The empty-string check still fires for
# the exit-0-empty-stdout edge case.
if ! BUILD_TS=$(git show -s --format=%cI HEAD); then
echo "::error::auto-build-timestamp=true but 'git show -s --format=%cI HEAD' failed. See the git error above. Check that actions/checkout completed and HEAD points at a real commit."
exit 1
fi
if [[ -z "${BUILD_TS}" ]]; then
Expand Down
Loading