Skip to content

Commit 5702473

Browse files
corbinlcclaude
andcommitted
Fix: check DockerHub secret via run step, not if: expression
GitHub Actions does not allow the secrets context in if: conditions during workflow dispatch validation. Gate the DockerHub login on a steps output instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2d4d897 commit 5702473

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,16 @@ jobs:
7171
username: ${{ github.actor }}
7272
password: ${{ secrets.GITHUB_TOKEN }}
7373

74+
- name: Check DockerHub credentials
75+
id: dh
76+
env:
77+
DH_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
78+
run: |
79+
[ -n "$DH_TOKEN" ] && echo "available=true" >> "$GITHUB_OUTPUT" \
80+
|| echo "available=false" >> "$GITHUB_OUTPUT"
81+
7482
- uses: docker/login-action@v3
75-
if: ${{ secrets.DOCKERHUB_TOKEN != '' }}
83+
if: steps.dh.outputs.available == 'true'
7684
with:
7785
username: ${{ secrets.DOCKERHUB_USERNAME }}
7886
password: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)