Skip to content

Commit 2ee4c43

Browse files
committed
ci: restore environment scoping, add secret validation step
Add explicit check that DATABASE_URL is set before running migrations. Restore environment: production for migrate and deploy jobs.
1 parent eca3dd8 commit 2ee4c43

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/deploy-api.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
needs: check
6161
runs-on: ubuntu-latest
6262
timeout-minutes: 5
63+
environment: production
6364
steps:
6465
- uses: actions/checkout@v4
6566

@@ -69,6 +70,16 @@ jobs:
6970

7071
- run: bun install --frozen-lockfile
7172

73+
- name: Validate secrets
74+
run: |
75+
if [ -z "$DATABASE_URL" ]; then
76+
echo "::error::DATABASE_URL secret is not set. Add it to repo Settings → Secrets or the 'production' environment."
77+
exit 1
78+
fi
79+
echo "DATABASE_URL is set (${#DATABASE_URL} chars)"
80+
env:
81+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
82+
7283
- name: Run database migrations
7384
run: bun run db:migrate:run
7485
env:
@@ -79,6 +90,7 @@ jobs:
7990
needs: migrate
8091
runs-on: ubuntu-latest
8192
timeout-minutes: 15
93+
environment: production
8294
steps:
8395
- uses: actions/checkout@v4
8496

0 commit comments

Comments
 (0)