File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -214,19 +214,23 @@ jobs:
214214 - name : Extract branch and SHA
215215 id : extract-branch
216216 run : |
217- # Use the recommended GITHUB_HEAD_REF for PRs, fallback to GITHUB_REF for pushes
218- BRANCH_NAME_RAW="${{ github.head_ref || github.ref_name } }"
217+ # Use HEAD_REF for PRs, fallback to REF_NAME for pushes.
218+ BRANCH_NAME_RAW="${HEAD_REF:-$REF_NAME }"
219219 # Clean up the ref by removing 'refs/heads/' or 'refs/tags/'
220220 BRANCH_NAME="${BRANCH_NAME_RAW#refs/heads/}"
221221 BRANCH_NAME="${BRANCH_NAME#refs/tags/}"
222222
223223 # A manual input from workflow_dispatch will always override the detected branch name
224- if [ -n "${{ github.event.inputs.branch } }" ]; then
225- BRANCH_NAME="${{ github.event.inputs.branch } }"
224+ if [ -n "${MANUAL_BRANCH }" ]; then
225+ BRANCH_NAME="${MANUAL_BRANCH }"
226226 fi
227227
228228 echo "branch=${BRANCH_NAME}" >> $GITHUB_OUTPUT
229229 echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
230+ env :
231+ HEAD_REF : ${{ github.head_ref }}
232+ REF_NAME : ${{ github.ref_name }}
233+ MANUAL_BRANCH : ${{ inputs.branch }}
230234
231235 - name : Build image
232236 uses : docker/build-push-action@v6
You can’t perform that action at this time.
0 commit comments