Closed jsoref closed 1 year ago
The main goal of this action is to push the image not build. So if it can't push, it should bail out early. I am open to discussion to change the behavior. Let's hear from other folks.
Dropping this enhancement request as it does not provide an excellent outcome for most of the users. Maybe, we can look at it later.
When a PR is made from a fork, secrets will generally be empty (for security reasons).
As such, these will be empty: https://github.com/RafikFarhad/push-to-gcr-github-action/blob/241707854fb71f655ec4e2a98bb16505f218bcc2/.github/workflows/build_and_push.yaml#L18 https://github.com/RafikFarhad/push-to-gcr-github-action/blob/241707854fb71f655ec4e2a98bb16505f218bcc2/.github/workflows/build_and_push.yaml#L37 https://github.com/RafikFarhad/push-to-gcr-github-action/blob/241707854fb71f655ec4e2a98bb16505f218bcc2/.github/workflows/build_and_push.yaml#L52
Collectively, those mean that: https://github.com/RafikFarhad/push-to-gcr-github-action/blob/241707854fb71f655ec4e2a98bb16505f218bcc2/entrypoint.sh#L16 will be empty.
Note that the condition in question works like this:
The code then flows here: https://github.com/RafikFarhad/push-to-gcr-github-action/blob/241707854fb71f655ec4e2a98bb16505f218bcc2/entrypoint.sh#L27
Where it fails.
Ideally the workflow would check to see if it has a secret and if it doesn't, it should still build the image, but, it could then not actually push it anywhere.
It's ok to trigger a
notice
or a sibling. And it'd be reasonable to generate an output to indicate if push(es) happened.