Skip to content

Commit 64b0f96

Browse files
committed
Fix invalid workflow: secrets context unavailable in job-level if
The `secrets` context is not available in job-level `if` conditionals in GitHub Actions, causing the workflow file to be rejected with: Unrecognized named-value: 'secrets' Move the DATABASE_URL check into a step that sets an output, then gate all subsequent steps on that output. This keeps the same skip-when-no-secret behavior while using only valid expression contexts. https://claude.ai/code/session_01UyJVDfW8tzi4a7qrN7uQzw
1 parent 5a80a5c commit 64b0f96

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,43 @@ jobs:
8181
# Add it under GitHub → Settings → Secrets and variables → Actions.
8282
# The app uses @neondatabase/serverless (HTTP-based), so a standard local
8383
# Postgres container is not sufficient — use a real Neon test database.
84-
if: ${{ secrets.DATABASE_URL != '' }}
8584
env:
8685
DATABASE_URL: ${{ secrets.DATABASE_URL }}
8786
# SESSION_SECRET can be any string for test purposes
8887
SESSION_SECRET: ${{ secrets.SESSION_SECRET || 'ci-integration-test-secret' }}
8988
steps:
89+
- name: Check for required secrets
90+
id: check-secrets
91+
run: |
92+
if [ -z "$DATABASE_URL" ]; then
93+
echo "skip=true" >> "$GITHUB_OUTPUT"
94+
echo "::notice::Skipping integration tests — DATABASE_URL secret is not configured"
95+
else
96+
echo "skip=false" >> "$GITHUB_OUTPUT"
97+
fi
98+
9099
- uses: actions/checkout@v6
100+
if: steps.check-secrets.outputs.skip != 'true'
91101

92102
- uses: pnpm/action-setup@v4
103+
if: steps.check-secrets.outputs.skip != 'true'
93104
with:
94105
version: latest
95106

96107
- uses: actions/setup-node@v6
108+
if: steps.check-secrets.outputs.skip != 'true'
97109
with:
98110
node-version: "20"
99111
cache: "pnpm"
100112

101113
- name: Install dependencies
114+
if: steps.check-secrets.outputs.skip != 'true'
102115
run: pnpm install --frozen-lockfile
103116

104117
- name: Apply database migrations
118+
if: steps.check-secrets.outputs.skip != 'true'
105119
run: pnpm db:migrate
106120

107121
- name: Run integration tests
122+
if: steps.check-secrets.outputs.skip != 'true'
108123
run: pnpm test:integration

0 commit comments

Comments
 (0)