Skip to content

Commit e4ae43e

Browse files
csharpfritzCopilot
andauthored
fix(ci): use env var pattern for secrets in workflow if conditions (#374)
GitHub Actions rejects secrets.* in step-level if conditions during workflow validation, causing 0 jobs and 'workflow file issue' errors. Both nuget.yml and deploy-server-side.yml now pass secrets through env: block first, then reference env.VAR_NAME in the if condition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d9a295b commit e4ae43e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/deploy-server-side.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ jobs:
6666
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
6767
6868
- name: Trigger Azure App Service deployment
69-
if: ${{ secrets.AZURE_WEBAPP_WEBHOOK_URL != '' }}
69+
env:
70+
AZURE_WEBAPP_WEBHOOK_URL: ${{ secrets.AZURE_WEBAPP_WEBHOOK_URL }}
71+
if: env.AZURE_WEBAPP_WEBHOOK_URL != ''
7072
run: |
71-
curl -sf -X POST "${{ secrets.AZURE_WEBAPP_WEBHOOK_URL }}" \
73+
curl -sf -X POST "${{ env.AZURE_WEBAPP_WEBHOOK_URL }}" \
7274
-H "Content-Length: 0" \
7375
--max-time 60 \
7476
|| echo "::warning::Azure webhook call failed — the App Service may need to be updated manually"

.github/workflows/nuget.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ jobs:
4141
run: dotnet nuget push ./nupkg/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
4242

4343
- name: Push to nuget.org
44-
if: ${{ secrets.NUGET_API_KEY != '' }}
45-
run: dotnet nuget push ./nupkg/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
44+
env:
45+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
46+
if: env.NUGET_API_KEY != ''
47+
run: dotnet nuget push ./nupkg/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ env.NUGET_API_KEY }} --skip-duplicate
4648

4749
- name: Upload NuGet package artifact
4850
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)