ci: keep master green — skip Docker publish when secrets are absent - #13
Conversation
Enabling Actions made main.yml run on master, where it failed at 'Login to DockerHub' because DOCKERHUB_USERNAME/DOCKERHUB_TOKEN are not configured in this repo -- turning master red on every push. Gate the publish steps on the credentials being present: when unset, the job prints a notice and succeeds without publishing; when set, it logs in and pushes as before. Also correct the now-stale main.yml description in CLAUDE.md (it is master-only since it was scoped).
Code Review by Qodo
1.
|
PR Summary by QodoKeep master CI green when DockerHub secrets are absent
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Address review: the secrets were declared as job-level env, exposing them to the QEMU/Buildx/build-push actions too. Only the shell check reads them as env (the login action receives them via its inputs), so move the env onto that step alone.
Why
After Actions was enabled and
main.ymlwas scoped tomaster, theci(Docker publish) job now runs on every push tomaster— and fails atLogin to DockerHubbecauseDOCKERHUB_USERNAME/DOCKERHUB_TOKENare not configured in this repo (gh secret listis empty). That turnedmasterred (testand CodeQL are green; only the publish fails).This workflow only triggers on push to
master(never onpull_request), so the failure cannot appear as a PR check — it surfaces only after merge, on the master push.Fix
Gate the publish steps on the credentials being present:
::notice::and succeeds without publishing →mastergoes green.:latest+:${{ github.sha }}frommaster, exactly as before.No image is published while secrets are absent, so nothing gets pushed to Docker Hub unintentionally.
Also corrects the now-stale
main.ymldescription inCLAUDE.md(it is master-only since being scoped).Alternatives (say the word)
DOCKERHUB_*secrets if you actually want to publish from this repo.