Skip to content

Commit e21fe11

Browse files
samuelho-devclaude
andcommitted
fix(helm-publish): fix secrets reference in if condition
GitHub Actions doesn't allow direct secrets references in `if:` conditions for reusable workflows. Move the secret access to an environment variable and check it at runtime instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c4810af commit e21fe11

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/helm-publish.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,16 @@ jobs:
171171
helm provenance "$CHART_FILE" || echo "⚠️ Provenance generation failed (GPG key may not be configured)"
172172
173173
- name: Import GPG key
174-
if: inputs.sign-chart && secrets.gpg-private-key != ''
174+
if: inputs.sign-chart
175+
env:
176+
GPG_KEY: ${{ secrets.gpg-private-key }}
175177
run: |
176-
echo "${{ secrets.gpg-private-key }}" | gpg --batch --import
177-
gpg --list-secret-keys
178+
if [ -n "$GPG_KEY" ]; then
179+
echo "$GPG_KEY" | gpg --batch --import
180+
gpg --list-secret-keys
181+
else
182+
echo "⚠️ No GPG key provided, skipping import"
183+
fi
178184
179185
- name: Log in to primary registry
180186
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0

0 commit comments

Comments
 (0)