Skip to content

Commit f75a2f9

Browse files
Copilotbeevelop
andauthored
ci: skip Docker Hub login and push for PR/Dependabot runs
Co-authored-by: beevelop <6891349+beevelop@users.noreply.github.com>
1 parent 0aac6bd commit f75a2f9

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/docker.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
main:
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 30
17+
env:
18+
# Docker Hub credentials are not available for pull requests and Dependabot runs
19+
publish: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
1720
steps:
1821
- name: Check out the repo
1922
uses: actions/checkout@v7
@@ -33,6 +36,7 @@ jobs:
3336
- name: Set up Docker Buildx
3437
uses: docker/setup-buildx-action@v4
3538
- name: Login to Docker Hub
39+
if: env.publish == 'true'
3640
uses: docker/login-action@v4.6.0
3741
with:
3842
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -48,8 +52,9 @@ jobs:
4852
id: docker_build
4953
uses: docker/build-push-action@v7
5054
with:
51-
platforms: ${{ env.platforms }}
52-
push: ${{ github.event_name != 'pull_request' }}
55+
platforms: ${{ env.publish == 'true' && env.platforms || 'linux/amd64' }}
56+
push: ${{ env.publish == 'true' }}
57+
load: ${{ env.publish != 'true' }}
5358
tags: ${{ steps.docker_meta.outputs.tags }}
5459
labels: ${{ steps.docker_meta.outputs.labels }}
5560
cache-from: type=local,src=${{ github.workspace }}/cache

0 commit comments

Comments
 (0)