Skip to content
GitHub default branch metadata change and Railway autodeploy
edgarc24-cloud
OP

a month ago

I have a Railway Production service connected to a GitHub repository. Its deployment trigger is explicitly connected to branch main, and Auto Deploy is enabled.

No commits, pushes, merges, branch deletions, branch renames, or branch-head changes will occur.

I want to temporarily change only the GitHub repository metadata property default_branch from the existing main branch to an existing staging branch, and later restore it from staging to main.

The Railway connected branch remains main throughout, and the SHA of main does not change.

Can either metadata-only operation by itself cause Railway to:

  • create or queue a deployment;
  • rebuild or redeploy the existing main commit;
  • restart or replace the running service;
  • treat the existing main commit as a missed/new commit; or
  • otherwise trigger deployment behavior through the Railway GitHub App?

Please confirm separately for:

  1. default_branch: main → staging
  2. default_branch: staging → main

In particular, can restoring main as the GitHub default branch cause Railway Auto Deploy to replay or deploy a commit that was already present on main throughout the entire operation?

Solved

3 Replies

Railway
BOT

a month ago

No. Changing the repository's default branch is a metadata-only change on GitHub, and neither direction (main → staging, or staging → main) by itself creates or queues a deployment, rebuilds or redeploys the existing main commit, restarts or replaces the running service, or treats that commit as new or missed.

Auto Deploy on a service connected to a specific branch is driven by pushes to that branch, so with main's SHA unchanged and no pushes, restoring main as the default branch will not replay or deploy a commit that was already on main.

The connected branch on your service is stored as main and does not follow the GitHub default branch, so the temporary change to staging does not redirect your Production trigger either.


Status changed to Awaiting User Response Railway • 30 days ago


Railway
BOT

21 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 21 days ago


Railway

No. Changing the repository's default branch is a metadata-only change on GitHub, and neither direction (main → staging, or staging → main) by itself creates or queues a deployment, rebuilds or redeploys the existing main commit, restarts or replaces the running service, or treats that commit as new or missed. Auto Deploy on a service connected to a specific branch is driven by pushes to that branch, so with main's SHA unchanged and no pushes, restoring main as the default branch will not replay or deploy a commit that was already on main. The connected branch on your service is stored as main and does not follow the GitHub default branch, so the temporary change to staging does not redirect your Production trigger either.

edgarc24-cloud
OP

7 days ago

Thank you. This answers the technical question clearly.

Before relying on this behavior for a Production change-control procedure, could a Railway staff member please confirm that the answer above is correct?

Specifically, with the Railway service remaining connected to "main", Auto Deploy enabled, and with no commits, pushes, merges, branch-head changes, or Railway configuration changes:

  1. Changing only GitHub "default_branch" from "main" to "staging" will not create or queue a Railway deployment or restart/redeploy the service.

  2. Changing only GitHub "default_branch" from "staging" back to "main" will not create or queue a deployment, and will not replay or redeploy the commit that was already present on "main".

I’m only requesting human confirmation of the behavior described above; no project-specific investigation is needed.

Thank you.


Status changed to Awaiting Railway Response Railway • 7 days ago


Railway
BOT

7 days ago

Autodeploys run when new commits are pushed to the service's connected branch, and that trigger branch is the one set in the service's settings (Controlling GitHub Autodeploys). With the service connected to main, no pushes, and no change to main's commit, a default branch change on its own is not a push to the connected branch.

That applies in both directions. Changing the default branch from main to staging does not change the branch your Production service deploys from, and changing it back to main is not a new commit on main, so it does not count as a new or missed commit to deploy.

For a change-control procedure, it is worth checking the service's deployment history afterwards (including skipped deployments) to confirm no new deployment appeared during either change.


Status changed to Awaiting User Response Railway • 7 days ago


Railway
BOT

5 minutes ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • 5 minutes ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...