Skip to content

Skip Docker Hub login and push for PR/Dependabot workflow runs - #50

Merged
beevelop merged 1 commit into
latestfrom
copilot/skip-dockerhub-login-for-prs
Sep 1, 2026
Merged

Skip Docker Hub login and push for PR/Dependabot workflow runs#50
beevelop merged 1 commit into
latestfrom
copilot/skip-dockerhub-login-for-prs

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Dependabot runs of the Docker Image workflow fail with Error: Username and password required, since secrets.DOCKERHUB_* are not exposed to those runs — and publishing isn't wanted there anyway.

Changes

  • Gate publishing on a single flag — job-level publish env, false for pull requests and Dependabot actors; Login to Docker Hub is now conditional on it.
  • Fix the push guardpush: previously checked github.event_name != 'pull_request', which never matches Dependabot's branch pushes; without a login that step would fail with denied. It now follows publish.
  • Keep the Trivy scan working without a registry — non-publishing runs build linux/amd64 only and load the image into the local daemon, since multi-platform builds cannot be loaded and the scanner needs a resolvable image ref.
env:
  publish: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
# ...
- name: Login to Docker Hub
  if: env.publish == 'true'
# ...
  platforms: ${{ env.publish == 'true' && env.platforms || 'linux/amd64' }}
  push: ${{ env.publish == 'true' }}
  load: ${{ env.publish != 'true' }}

Net effect: PR/Dependabot runs still build and vulnerability-scan the image, they just skip authentication and publishing.

Co-authored-by: beevelop <6891349+beevelop@users.noreply.github.com>
Copilot AI changed the title ci: skip Docker Hub login and push for PR/Dependabot runs Skip Docker Hub login and push for PR/Dependabot workflow runs Sep 1, 2026
Copilot AI requested a review from beevelop September 1, 2026 14:27
@beevelop
beevelop marked this pull request as ready for review September 1, 2026 14:29
@beevelop
beevelop merged commit 35cc5b9 into latest Sep 1, 2026
2 checks passed
@beevelop
beevelop deleted the copilot/skip-dockerhub-login-for-prs branch September 1, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants