---
title: "Building GitHub with Ruby and Rails"
description: "GitHub's ~2M-line Rails monolith upgrades to the latest Rails main-branch commit every week via a scheduled GitHub Actions workflow that opens an automated PR, runs all builds, and ships the next day."
url: "https://swe.quest/articles/building-github-with-ruby-and-rails-99851966c067c871"
canonical: "https://github.blog/engineering/architecture-optimization/building-github-with-ruby-and-rails/"
source: "GitHub Engineering"
published: "2023-04-06"
difficulty: "medium"
kind: "Case study"
reading_minutes: 5
tags: ["ruby","refactoring","ci-cd","deployment","open-source"]
---

# Building GitHub with Ruby and Rails

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2023-04-06, 5 min read, Case study. Original: [https://github.blog/engineering/architecture-optimization/building-github-with-ruby-and-rails/](https://github.blog/engineering/architecture-optimization/building-github-with-ruby-and-rails/)

## Summary

GitHub's ~2M-line Rails monolith upgrades to the latest Rails main-branch commit every week via a scheduled GitHub Actions workflow that opens an automated PR, runs all builds, and ships the next day. CI also runs a parallel build against the latest Ruby commit, which let GitHub test Ruby 3.2 release candidates on production traffic, catch regressions such as a keyword-argument allocation increase before release, and adopt Ruby 3.2.1 on release day. Benefits include dropping nearly all Rails patches, avoiding big-bang migrations, and better security posture. The approach depends on a thorough test suite and progressive rollout deploys.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)

## Prerequisites

- Ruby on Rails basics ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- CI pipelines ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))

## Keywords

Ruby on Rails, Ruby 3.2, GitHub Actions, GitHub.com

## Related posts

- [Improving Git push times through faster server side hooks](https://swe.quest/articles/improving-git-push-times-through-faster-server-side-hooks-21ad6ccb34bf4962.md): GitHub Engineering · 2022-04-21 · Medium · 5 min read · Performance engineering, Version control, Go, Ruby, Refactoring & migrations
  GitHub cut pre-receive hook execution time on every Git push from about 880ms median to 10ms, dropping P99 by 95%, by rewriting the hooks from Ruby into its Go Git service.
- [Using Github Actions with Railway](https://swe.quest/articles/using-github-actions-with-railway-5eb8da35bcdd7f7c.md): Railway · 2021-06-04 · Medium · 2 min read · CI/CD, Deployment
  Railway deployments can be driven from GitHub Actions instead of the built-in branch-push trigger by creating a project token, storing it as a repository secret (RAILWAY\_TOKEN), and running \`railway up --service=\<id\>\` inside the official Railway CLI container.
- [How we ship GitHub Mobile every week](https://swe.quest/articles/how-we-ship-github-mobile-every-week-01e30a6ee9b48c0b.md): GitHub Engineering · 2022-01-12 · Medium · 7 min read · CI/CD, Mobile, Deployment
  GitHub Mobile ships weekly iOS and Android releases using a single GitHub Actions workflow that runs every Saturday.
- [Simple trick to save environment and money when using GitHub Actions](https://swe.quest/articles/simple-trick-to-save-environment-and-money-when-using-github-actions-14be6ffdb9f9e911.md): Turso · 2024-07-30 · Medium · 2 min read · CI/CD, Cost optimization
  GitHub Actions keeps running workflows for outdated pull request commits until they finish or fail.
- [How We Fixed the Dependency Confusion Vulnerability in Over 600 Ruby Applications](https://swe.quest/articles/how-we-fixed-the-dependency-confusion-vulnerability-in-over-600-ruby-14f9a0a0836510b2.md): Shopify Engineering · 2022-01-27 · Medium · 9 min read · Supply chain security, Ruby, Refactoring & migrations, CI/CD
  Shopify closed a dependency confusion hole across roughly 600 Ruby applications by migrating each \`Gemfile.lock\` to Bundler's newer format, which pins every gem to an explicit source.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
