Skip to content

Commit 44e81ab

Browse files
fix(ci): move NuGet secret check from if-condition to run script
secrets context not available in step if-conditions, causing workflow parse error. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e6e8f89 commit 44e81ab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ jobs:
8989
subject-path: packages/agent-governance-dotnet/nupkg/*.nupkg
9090

9191
- name: Publish to NuGet
92-
if: ${{ secrets.NUGET_API_KEY != '' }}
9392
working-directory: packages/agent-governance-dotnet
94-
run: dotnet nuget push ./nupkg/*.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
93+
env:
94+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
95+
run: |
96+
if [ -z "$NUGET_API_KEY" ]; then
97+
echo "::warning::NUGET_API_KEY not set, skipping NuGet publish"
98+
exit 0
99+
fi
100+
dotnet nuget push ./nupkg/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)