From 5a9175a38c071ae874ed0c4fe3de040582b17bb4 Mon Sep 17 00:00:00 2001 From: David Benson Date: Fri, 21 Aug 2026 14:22:22 -0400 Subject: [PATCH] Fix azure login moved login before docker build --- action.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/action.yml b/action.yml index 4cd8083..2004a87 100644 --- a/action.yml +++ b/action.yml @@ -106,6 +106,20 @@ runs: echo "image: $image_ref" echo "registry: $registry" + - name: Login to ${{ steps.image.outputs.registry }} + uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 + if: ${{ inputs.username != '' && inputs.password != '' }} + with: + registry: ${{ steps.image.outputs.registry }} + username: ${{ inputs.username }} + password: ${{ inputs.password }} + + - name: ACR Login + if: ${{ contains(steps.image.outputs.registry , '.azurecr.io') && inputs.password == ''}} + shell: bash + env: + STEPS_IMAGE_OUTPUTS_REGISTRY: ${{ steps.image.outputs.registry }} + run: az acr login --name ${STEPS_IMAGE_OUTPUTS_REGISTRY} - name: Build image (local load for scanning) uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 @@ -136,21 +150,6 @@ runs: github-token: ${{ inputs.github_token }} exit-code: ${{ inputs.allow_vulnerabilities != 'true' }} - - name: Login to ${{ steps.image.outputs.registry }} - uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 - if: ${{ inputs.username != '' && inputs.password != '' }} - with: - registry: ${{ steps.image.outputs.registry }} - username: ${{ inputs.username }} - password: ${{ inputs.password }} - - - name: ACR Login - if: ${{ contains(steps.image.outputs.registry , '.azurecr.io') }} - shell: bash - env: - STEPS_IMAGE_OUTPUTS_REGISTRY: ${{ steps.image.outputs.registry }} - run: az acr login --name ${STEPS_IMAGE_OUTPUTS_REGISTRY} - - name: Push image with attestations uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 with: