Skip to content

Commit 168c2b9

Browse files
committed
fix railway deploy auth env precedence
1 parent 3c304d2 commit 168c2b9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/deploy-railway-app.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
timeout-minutes: 30
2828
env:
29-
# Keep both names because Railway CLI behavior varies across versions.
30-
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
29+
# Workspace-scoped tokens must be passed as RAILWAY_API_TOKEN.
3130
RAILWAY_API_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
3231
RAILWAY_PROJECT_ID: ${{ secrets.RAILWAY_PROJECT_ID }}
3332
RAILWAY_ENVIRONMENT_ID: ${{ secrets.RAILWAY_ENVIRONMENT_ID }}
@@ -36,7 +35,7 @@ jobs:
3635
steps:
3736
- name: Validate Railway secrets
3837
run: |
39-
test -n "${RAILWAY_TOKEN}" || (echo "Missing secret: RAILWAY_TOKEN" && exit 1)
38+
test -n "${RAILWAY_API_TOKEN}" || (echo "Missing secret: RAILWAY_TOKEN" && exit 1)
4039
test -n "${RAILWAY_PROJECT_ID}" || (echo "Missing secret: RAILWAY_PROJECT_ID" && exit 1)
4140
test -n "${RAILWAY_ENVIRONMENT_ID}" || (echo "Missing secret: RAILWAY_ENVIRONMENT_ID" && exit 1)
4241
test -n "${RAILWAY_SERVICE_ID}" || (echo "Missing secret: RAILWAY_SERVICE_ID" && exit 1)
@@ -60,6 +59,10 @@ jobs:
6059
6160
- name: Deploy to Railway (CI mode)
6261
run: |
62+
# Some Railway CLI versions prefer RAILWAY_TOKEN when both are present.
63+
# Unset it to force workspace-token auth via RAILWAY_API_TOKEN.
64+
unset RAILWAY_TOKEN
65+
6366
# Railway builder failures can be transient (container bootstrap/network).
6467
# Retry the deploy to reduce false-negative workflow failures.
6568
for attempt in 1 2 3; do

0 commit comments

Comments
 (0)