diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index e04994903..fac6e3f17 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -91,6 +91,10 @@ jobs: sed -i 's|-base:.* AS stage-build|-base:${{ env.IMAGE_TAG }} AS stage-build|' Dockerfile - name: Commit changes + env: + HEAD_REF: ${{ github.event.pull_request.head.ref }} + INPUT_BRANCH: ${{ inputs.branch }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | if [ -z "$(git status --porcelain)" ]; then echo "No changes to commit." @@ -101,13 +105,11 @@ jobs: git add Dockerfile git commit -m "perf: Update Dockerfile with new base image tag" if [ "${{ github.event_name }}" = "pull_request" ]; then - git push origin HEAD:${{ github.event.pull_request.head.ref }} + git push origin HEAD:"$HEAD_REF" else - git push origin HEAD:${{ inputs.branch }} + git push origin HEAD:"$INPUT_BRANCH" fi if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.fork == false }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Skip push for fork PR if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true }}