Skip to content

fix(ci): fall back to GITHUB_REF_NAME when GITHUB_HEAD_REF is empty - #197

Merged
openoms merged 2 commits into
openoms:masterfrom
autoblitzbot:fix/ci-push-branch-fallback
Aug 15, 2026
Merged

openoms merged 2 commits into
openoms:masterfrom
autoblitzbot:fix/ci-push-branch-fallback

Conversation

@autoblitzbot

Copy link
Copy Markdown
Contributor

Problem

GITHUB_HEAD_REF is only set for pull_request events. On push to master the branch argument to the build scripts was empty, so the amd64 build downloaded:

https://raw.githubusercontent.com/openoms/joininbox//build_joininbox.sh

which 404s and fails the image build (wget exit 8) — see the master run after #196 merged.

Fix

Use ${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}} in both image-build workflows so push builds use the pushed branch name.

Related: the arm64 workflow had the same latent bug (its current master failure is a separate transient loop-device issue).

GITHUB_HEAD_REF is only set for pull_request events. On push to master
the branch argument was empty, so the build downloaded
https://raw.githubusercontent.com/openoms/joininbox//build_joininbox.sh
which 404s and fails the image build (wget exit 8).

Use ${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}} so push builds use the
pushed branch name.
@autoblitzbot
autoblitzbot force-pushed the fix/ci-push-branch-fallback branch from cd4d851 to 63a5ed9 Compare August 15, 2026 07:32

@RonDeBanc RonDeBanc 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.

Review of 63a5ed9af — APPROVE

Correct minimal fix for push builds. GITHUB_HEAD_REF is populated for pull requests but empty on push; ${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}} selects the PR source branch when present and the pushed branch name otherwise. Applying it consistently to both the diagnostic output and the actual amd64/arm64 build-script argument fixes the observed double-slash raw-content URL without changing PR behavior.

The value expansion cannot introduce shell control syntax through reparsing (shell metacharacters produced by parameter expansion are data, not newly parsed operators), and Git ref-name rules exclude whitespace/glob characters that would otherwise cause unwanted splitting or pathname expansion. Quoting the computed value via a temporary variable would still be cleaner, but is not required for supported GitHub refs.

All four checks pass, including full amd64 and arm64 image builds — direct integration proof of both event paths' build plumbing. LGTM.


Reviewed by Ron DeBanc (Hermes Agent)

The workflow-level fallback covers push events, but an explicitly passed
empty branch string (branch='') still defeated the scripts' master default
and produced the 404 on raw.githubusercontent.com/.../build_joininbox.sh.
Guard for empty in both build scripts as belt and braces.
@autoblitzbot

Copy link
Copy Markdown
Contributor Author

Added e5f4609: script-level belt and braces. Both ci/arm64-rpi/arm64-rpi.sh and ci/amd64/packer.build.amd64-debian.sh now fall back to master when the branch argument is passed but empty (branch='') — previously an explicit empty string defeated the scripts' own master default and produced the 404 on raw.githubusercontent.com/openoms/joininbox//build_joininbox.sh seen in the master image builds.

Root cause recap: GITHUB_HEAD_REF is only set for pull_request events; on push to master it is empty, so the wget URL collapsed. The workflow-level ${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}} fix plus the script-level empty guard together close both layers. Note: the push-event path can only be fully exercised after merge (PR builds always have GITHUB_HEAD_REF set).

@openoms

openoms commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Merging to fix the builds from master.

@openoms
openoms merged commit 4f992c5 into openoms:master Aug 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants