railway loginwhen running GitHub Action workflow
7 months ago
Hi.
I'm currently using the following workflow to deploy a Docker image to Railway using GitHub Actions:
name: Deploy Application
on:
workflow_run:
workflows: ["Deliver Application"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
env:
RAILWAY_ENVIRONMENT_ID: ${{ secrets.ENVIRONMENT_ID }}
RAILWAY_PROJECT_ID: ${{ secrets.PROJECT_ID }}
RAILWAY_SERVICE_ID: ${{ secrets.SERVICE_ID }}
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set Up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Railway CLI
run: npm install -g @railway/cli
- name: Deploy to Railway
run: |
railway link --service ${{ secrets.SERVICE_ID }} --project_id ${{ secrets.PROJECT_ID }} --environment ${{ secrets.ENVIRONMENT_ID }}
railway redeploy --yesBut when this workflow runs, I get this error: Unauthorized. Please login with railway login
PD: I followed the steps based on this blog post:
https://blog.railway.com/p/comparing-deployment-methods-in-railway
2 Replies
7 months ago
Hello,
You need to use an account token -
https://docs.railway.com/guides/cli#account-tokens
Best,
Brody
Status changed to Awaiting User Response Railway • 7 months ago
brody
Hello,You need to use an account token -https://docs.railway.com/guides/cli#account-tokensBest,Brody
7 months ago
Isn't it possible to use a project token? I just want to avoid bad actors to use my whole account for any unauthorized purpose in the case they get the token.
Status changed to Awaiting Railway Response Railway • 7 months ago
Status changed to Solved itsrems • 7 months ago