Index of every page on this site: llms.txt
All skills
Run it yourself

Define and manage Railway projects with Infrastructure as Code in .railway/railway.ts. Use when authoring or editing Railway IaC files, running railway config init/pull/plan/apply, declaring services, databases, volumes, buckets, domains, or env vars in code, setting up multi-repo partials, or wiring railway config into CI. Triggers on "railway iac", "railway.ts", "infrastructure as code railway", "railway config plan", "define railway services in code". For migrating railway.json/railway.toml, use the railway-iac-migration skill instead.

Use this Skill: https://skilld.dev/gh/sivarampg/railway-iac-skill/railway-iac

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesworkflows.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

IaC Workflows: CI, Plan Pinning, Partial Ownership

Apply from GitHub Actions

railwayapp/config plans on PRs and applies the reviewed plan on merge. The plan job pins the change set, the environment's configEtag, and the .railway/ git tree; the apply job applies that artifact without re-evaluating the authoring file. If the environment changed after the plan, or the merged .railway/ tree isn't the planned tree, apply fails. Re-plan.

  1. Create a project token for the target environment, store as RAILWAY_TOKEN repo secret. Project tokens are environment-scoped, so the workflow can only touch that environment.
  2. Install the TypeScript SDK in the repo (npm install railway) so the plan job can evaluate railway.ts.
  3. Add .github/workflows/railway-config.yml:
name: Railway config

on:
  pull_request:
    types: [opened, synchronize, reopened, closed]
    paths:
      - ".railway/**"

permissions:
  contents: read
  pull-requests: write
  actions: read
  id-token: write

jobs:
  plan:
    if: github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: railwayapp/config@v1
        with:
          command: plan
          railway-token: ${{ secrets.RAILWAY_TOKEN }}

  apply:
    if: github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.merge_commit_sha }}
      - uses: railwayapp/config@v1
        with:
          command: apply
          railway-token: ${{ secrets.RAILWAY_TOKEN }}

Every PR touching .railway/ gets a plan comment with the diff (destructive changes marked). Merging is the approval. Fork PRs are skipped (no secrets). id-token: write + the Railway GitHub App posts the comment as the Railway bot; without it, comments come from github-actions.

For multi-repo partial setups, add this workflow to every repository, each with a project token for the target environment.

CI without the action (any provider)

railway config plan --out railway-plan.json --detailed-exit-code   # 0 clean, 2 changes pending
railway config apply --plan railway-plan.json --yes --confirm-destructive

--plan applies the saved change set as-is and fails if the live configEtag drifted or the checked-out .railway/ tree differs from the planned tree.

Partial ownership commands

Ownership lives on the Railway environment; inspect or change it even if the original authoring file is gone. Release/transfer require environment ADMIN access and change only ownership metadata: no resource changes, deletes, redeploys, or file edits.

railway config partials list                     # partial names + owned addresses (--json for full map + configEtag)

railway config partials transfer legacy-ops operations \
  --resource service.api --resource service.admin --dry-run   # preview a move
railway config partials transfer legacy-ops operations        # move ALL of legacy-ops (omit --resource)

railway config partials release operations --dry-run          # preview releasing ownership
railway config partials release operations                    # release whole partial (or --resource for select addresses)

Resource addresses look like service.api, database.postgres.

Ownership rules enforced on every plan/apply

  • Declaring a resource owned by another partial fails with Cannot manage service "api": already managed by partial "web". Move the declaration to the owning repo, or transfer ownership first.
  • A file with no partial export fails in an environment that has named partials.
  • A named partial deletes only resources it owns; unowned/other-owned resources are left alone.
  • Whole-project planning requires zero named ownership remaining: release every partial, verify with partials list, then combine resources into one file and review the plan carefully (omitted resources get deleted).

After transferring or releasing

  1. Update the source file to stop declaring moved resources; add them to the destination file.
  2. Re-plan before applying either file. Ownership changes make saved plans stale.
  3. Don't re-apply an old named-partial config. It can reclaim released ownership.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides a secure and well-documented set of instructions for managing Railway Infrastructure as Code. It leverages official SDKs and GitHub Actions from the Railway organization and emphasizes security best practices, such as using the preserve() function to manage secrets and warning users about destructive operations and sensitive data exposure during configuration imports.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at ba3f473. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 2 months ago
metadata
{
  "version": "1.0.0"
}

README badge

README badge for sivarampg/railway-iac-skill/railway-iac