diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index cc79d95d5..a4fb5daa0 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -1,7 +1,9 @@ name: Build Docker Images on: - push: + workflow_run: + workflows: [Tests] + types: [completed] branches: - main - dev @@ -22,14 +24,17 @@ jobs: sync: runs-on: ubuntu-latest steps: - - name: Print branch name - run: | - echo "GITHUB_REF: ${{ github.ref}}" - echo "GITHUB_REF: ${{ github.ref_name}} - echo "GITHUB_EVENT_NAME: ${{ github.event_name}}" - echo "GITHUB_HEAD_REF: ${{ github.head_ref}} - echo "GITHUB_BASE_REF: ${{ github.base_ref}} + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_sha }} + - name: Extract branch name + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + - name: Print branch name + run: echo "${{ steps.extract_branch.outputs.branch }}" docker-build: + if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} strategy: matrix: include: diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0d14652e9..188b0bd2a 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -31,6 +31,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_sha }} - name: Docker Login if: ${{ inputs.push == true && github.ref_name == 'main' }}