File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments