From 78b8a93fe1452699727339405c1cdf691dfdb9f9 Mon Sep 17 00:00:00 2001 From: Fahad Date: Mon, 9 Jun 2025 09:39:42 +0400 Subject: [PATCH] fix: correct GitHub Actions workflow syntax for secrets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix invalid secrets reference in job-level if condition - Add proper API key availability check with conditional steps - Gracefully handle missing GEMINI_API_KEY secret - Live tests now skip cleanly when no API key is configured 🔧 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/test.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8046924..5d31292 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,8 +64,8 @@ jobs: live-tests: runs-on: ubuntu-latest - # Only run live tests if API key secret is available - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.GEMINI_API_KEY != '' + # Only run live tests on main branch pushes (requires manual API key setup) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 @@ -79,9 +79,27 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt + - name: Check API key availability + id: check-key + run: | + if [ -z "${{ secrets.GEMINI_API_KEY }}" ]; then + echo "api_key_available=false" >> $GITHUB_OUTPUT + echo "⚠️ GEMINI_API_KEY secret not configured - skipping live tests" + else + echo "api_key_available=true" >> $GITHUB_OUTPUT + echo "✅ GEMINI_API_KEY found - running live tests" + fi + - name: Run live integration tests + if: steps.check-key.outputs.api_key_available == 'true' run: | # Run live tests that make actual API calls python tests/test_live_integration.py env: - GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} \ No newline at end of file + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + + - name: Skip live tests + if: steps.check-key.outputs.api_key_available == 'false' + run: | + echo "🔒 Live integration tests skipped (no API key configured)" + echo "To enable live tests, add GEMINI_API_KEY as a repository secret" \ No newline at end of file