Skip to content

Commit 95fba77

Browse files
committed
fix: restore PR head branch detection lost in #172 merge
Re-apply the GH_HEAD_REF fix from #168 which was overwritten when #172 was merged. Without this, PR-triggered CodeBuild runs fail because CURRENT_BRANCH resolves to '155/merge' instead of the actual PR source branch.
1 parent 675c766 commit 95fba77

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

.github/workflows/codebuild.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ jobs:
174174
variables:
175175
GH_TOKEN: ${{ github.token }}
176176
GH_REF_NAME: ${{ github.ref_name }}
177+
GH_HEAD_REF: ${{ github.head_ref }}
177178
GH_EVENT_NAME: ${{ github.event_name }}
178179
phases:
179180
install:
@@ -191,7 +192,7 @@ jobs:
191192
build:
192193
commands:
193194
- DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null || echo "main")
194-
- CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "${GH_REF_NAME:-}")
195+
- CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "${GH_HEAD_REF:-${GH_REF_NAME:-}}")
195196
- CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
196197
- IS_RELEASE=$([[ -n "$CURRENT_TAG" ]] && echo "true" || echo "false")
197198
- IS_PRE_RELEASE=$([[ "$CURRENT_BRANCH" == "$DEFAULT_BRANCH" ]] && echo "true" || echo "false")

0 commit comments

Comments
 (0)