Skip to content

Commit 8c19c37

Browse files
committed
Update workflow
1 parent 57f9670 commit 8c19c37

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/docker-image-local.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,19 @@ jobs:
2121

2222
- name: Determine target branch
2323
run: |
24-
# workflow_run payload contains the head_branch (the branch that triggered the original run)
25-
echo "TRIGGER_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
24+
set -euo pipefail
25+
if command -v jq >/dev/null 2>&1; then
26+
TARGET=$(jq -r '.workflow_run.pull_requests[0].base.ref // .workflow_run.head_branch // empty' "$GITHUB_EVENT_PATH" || true)
27+
else
28+
TARGET="${{ github.event.workflow_run.head_branch }}"
29+
fi
30+
if [ -z "${TARGET:-}" ]; then
31+
echo "TRIGGER_BRANCH=local" >> $GITHUB_ENV
32+
echo "Determined TRIGGER_BRANCH=local"
33+
else
34+
echo "TRIGGER_BRANCH=$TARGET" >> $GITHUB_ENV
35+
echo "Determined TRIGGER_BRANCH=$TARGET"
36+
fi
2637
2738
- name: Detect backend changes between target and main
2839
id: detect

0 commit comments

Comments
 (0)