11 days ago
Got a gh action that runs the plan and applies it, it all executes but no changes are really applied to the environment.
project id: 121c6f52-528e-486e-af85-a4b58d8e8cbc
i also tried applying the config in my machine but nothing worked, had to tell my agent to apply the changes manually with the api/mcp
Pinned Solution
10 days ago
Thank you! Few things I'm noticing, you're defining a bunch of env vars in there, I don't actually think they get applied like that. You'll want to use a project token instead (Project -> Tokens -> Create), set it as RAILWAY_TOKEN. I took yours and kinda applied the correct fixes using the official Railway action as reference. Hope this helps!
name: Railway IaC
on:
pull_request:
paths:
- ".railway/**"
- ".github/workflows/railway-apply.yml"
push:
branches: [master]
paths:
- ".railway/**"
- ".github/workflows/railway-apply.yml"
workflow_dispatch:
concurrency:
group: railway-iac-apply
cancel-in-progress: false
jobs:
plan:
if: github.event_name == 'pull_request'
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v4
- uses: railwayapp/config@v1
with:
command: plan
railway-token: ${{ secrets.RAILWAY_TOKEN }}
apply:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
id-token: write
actions: read
steps:
- uses: actions/checkout@v4
- uses: railwayapp/config@v1
with:
command: apply
railway-token: ${{ secrets.RAILWAY_TOKEN }}
confirm-destructive: "true"
9 Replies
11 days ago
This is a question about using Railway itself, and the quickest answer usually comes from people who have set up the same thing and can tell you how they got it working.
So we'd like to open your thread as a community bounty. Railway pays a bounty to the community member who answers it, and threads like this usually get picked up quickly.
Opening it makes this entire thread public, including everything already posted. Nothing becomes public until you decide. Use the buttons below.
- Open to the community - Before you click, take a moment to edit or remove anything you'd rather not share. The thread becomes publicly visible right away.
- Keep it private and close the thread - Nothing becomes public and the thread closes.
Status changed to Awaiting User Response Railway • 11 days ago
11 days ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • 11 days ago
11 days ago
Out of curiosity, why not use the official workflow?
dev
Out of curiosity, why not use the official workflow? https://github.com/railwayapp/config
11 days ago
that's just how the agent configured it, didn't even know (neither the agent) that workflow existed
11 days ago
and the action only runs on pushes to main and the config is changed
Attachments
10 days ago
Thank you! Few things I'm noticing, you're defining a bunch of env vars in there, I don't actually think they get applied like that. You'll want to use a project token instead (Project -> Tokens -> Create), set it as RAILWAY_TOKEN. I took yours and kinda applied the correct fixes using the official Railway action as reference. Hope this helps!
name: Railway IaC
on:
pull_request:
paths:
- ".railway/**"
- ".github/workflows/railway-apply.yml"
push:
branches: [master]
paths:
- ".railway/**"
- ".github/workflows/railway-apply.yml"
workflow_dispatch:
concurrency:
group: railway-iac-apply
cancel-in-progress: false
jobs:
plan:
if: github.event_name == 'pull_request'
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v4
- uses: railwayapp/config@v1
with:
command: plan
railway-token: ${{ secrets.RAILWAY_TOKEN }}
apply:
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
id-token: write
actions: read
steps:
- uses: actions/checkout@v4
- uses: railwayapp/config@v1
with:
command: apply
railway-token: ${{ secrets.RAILWAY_TOKEN }}
confirm-destructive: "true"
dev
Thank you! Few things I'm noticing, you're defining a bunch of env vars in there, I don't actually think they get applied like that. You'll want to use a project token instead (Project -> Tokens -> Create), set it as `RAILWAY_TOKEN`. I took yours and kinda applied the correct fixes using the official Railway action as reference. Hope this helps! ``` name: Railway IaC on: pull_request: paths: - ".railway/**" - ".github/workflows/railway-apply.yml" push: branches: [master] paths: - ".railway/**" - ".github/workflows/railway-apply.yml" workflow_dispatch: concurrency: group: railway-iac-apply cancel-in-progress: false jobs: plan: if: github.event_name == 'pull_request' runs-on: blacksmith-2vcpu-ubuntu-2404 timeout-minutes: 15 permissions: contents: read pull-requests: write id-token: write actions: read steps: - uses: actions/checkout@v4 - uses: railwayapp/config@v1 with: command: plan railway-token: ${{ secrets.RAILWAY_TOKEN }} apply: if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' runs-on: blacksmith-2vcpu-ubuntu-2404 timeout-minutes: 15 permissions: contents: read id-token: write actions: read steps: - uses: actions/checkout@v4 - uses: railwayapp/config@v1 with: command: apply railway-token: ${{ secrets.RAILWAY_TOKEN }} confirm-destructive: "true" ```
10 days ago
thx
Status changed to Awaiting User Response Railway • 10 days ago
Status changed to Solved dev • 10 days ago