Skip to content

Commit 92954aa

Browse files
committed
don't try login on pull_request
1 parent 13b18ab commit 92954aa

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/docker-publish-full.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
# github.repository as <account>/<repo>
2020
IMAGE_NAME: ${{ github.repository }}-full
2121
# docker.io/<account>/<repo>
22-
DOCKERHUB_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-full
22+
AUTHOR: urenko
2323

2424

2525
jobs:
@@ -62,6 +62,7 @@ jobs:
6262
password: ${{ secrets.GITHUB_TOKEN }}
6363
-
6464
name: Login to Docker Hub
65+
if: github.event_name != 'pull_request'
6566
uses: docker/login-action@v3
6667
with:
6768
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -79,7 +80,7 @@ jobs:
7980
id: meta_dockerhub
8081
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
8182
with:
82-
images: docker.io/${{ env.DOCKERHUB_IMAGE }}
83+
images: docker.io/${{ secrets.DOCKERHUB_USERNAME || env.AUTHOR }}/${{ github.event.repository.name }}-full
8384

8485
# Build and push Docker image with Buildx (don't push on PR)
8586
# https://github.com/docker/build-push-action

.github/workflows/docker-publish-minimal.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
# github.repository as <account>/<repo>
2020
IMAGE_NAME: ${{ github.repository }}
2121
# docker.io/<account>/<repo>
22-
DOCKERHUB_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
22+
AUTHOR: urenko
2323

2424

2525
jobs:
@@ -62,6 +62,7 @@ jobs:
6262
password: ${{ secrets.GITHUB_TOKEN }}
6363
-
6464
name: Login to Docker Hub
65+
if: github.event_name != 'pull_request'
6566
uses: docker/login-action@v3
6667
with:
6768
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -79,7 +80,7 @@ jobs:
7980
id: meta_dockerhub
8081
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
8182
with:
82-
images: docker.io/${{ env.DOCKERHUB_IMAGE }}
83+
images: docker.io/${{ secrets.DOCKERHUB_USERNAME || env.AUTHOR }}/${{ github.event.repository.name }}
8384

8485
# Build and push Docker image with Buildx (don't push on PR)
8586
# https://github.com/docker/build-push-action

0 commit comments

Comments
 (0)