graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
sdk: fix publish workflow — 'secrets' is invalid in if: conditions
Rach Pradhanaaa00b3202fe
diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.ymlindex d689db1c..7d5e0f94 100644--- a/.github/workflows/sdk.yml+++ b/.github/workflows/sdk.yml@@ -12,6 +12,10 @@ on:jobs:generate:runs-on: ubuntu-latest+ # `secrets` cannot be used in `if:` — hoist presence to env flags first.+ env:+ HAVE_NPM_TOKEN: ${{ secrets.NPM_TOKEN != '' }}+ HAVE_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN != '' }}steps:- uses: actions/checkout@v4@@ -41,12 +45,12 @@ jobs:# --- Publish (only fires when the token secret exists) ---- uses: actions/setup-node@v4- if: ${{ secrets.NPM_TOKEN != '' }}+ if: ${{ env.HAVE_NPM_TOKEN == 'true' }}with:node-version: "20"registry-url: "https://registry.npmjs.org"- name: Publish TS SDK to npm- if: ${{ secrets.NPM_TOKEN != '' && startsWith(github.ref, 'refs/tags/sdk-v') }}+ if: ${{ env.HAVE_NPM_TOKEN == 'true' && startsWith(github.ref, 'refs/tags/sdk-v') }}working-directory: sdk/tsenv:NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}@@ -55,11 +59,11 @@ jobs:npm publish --access public- uses: actions/setup-python@v5- if: ${{ secrets.PYPI_TOKEN != '' }}+ if: ${{ env.HAVE_PYPI_TOKEN == 'true' }}with:python-version: "3.12"- name: Publish Python SDK to PyPI- if: ${{ secrets.PYPI_TOKEN != '' && startsWith(github.ref, 'refs/tags/sdk-v') }}+ if: ${{ env.HAVE_PYPI_TOKEN == 'true' && startsWith(github.ref, 'refs/tags/sdk-v') }}working-directory: sdk/pyenv:TWINE_USERNAME: __token__