elgohr / Publish-Docker-Github-Action

A Github Action used to build and publish Docker images
MIT License
781 stars 209 forks source link

[FEATURE] `no_push: true` should not complain about missing credentials #110

Closed casperdcl closed 3 years ago

casperdcl commented 3 years ago

When no_push: true, don't complain about blank username/password.

Use case:

- uses: elgohr/Publish-Docker-Github-Action@master
  with:
    name: ${{ github.repository }}
    password: ${{ secrets.DOCKER_PWD }}  # obviously blank on pull_request
    username: ${{ secrets.DOCKER_USR }}  # obviously blank on pull_request
    no_push: ${{ github.event_name == 'pull_request' }}

this will allow testing that the image builds on pull requests, but won't try to login. (Neater than duplicating two different versions of the block with if: github.event_name == 'pull_request' and github.event_name != 'pull_request'.)

elgohr commented 3 years ago

Hey, totally understand why you come to that point. Sadly the login is necessary, due to the fact that you could depend on an image from a private registry. Makes sense?

casperdcl commented 3 years ago

yes but that means the login should be optional. As you say, it's only necessary for builds which require login to private registries.

Your argument is like saying github should not allow pulling public repos without login.

casperdcl commented 3 years ago

will change the PR slightly to allow blank login iff no_push is defined.

casperdcl commented 3 years ago

already updated #111 3 days ago btw...

credentials required not required
provided ok ok
not provided fails should not fail; fixed by #111
elgohr commented 3 years ago

Please give me some time, will have a look