Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

GitHub Engineering 5 min read Case study mediumAdept

Building GitHub with Ruby and Rails

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.

Related posts

  • Improving Git push times through faster server side hooks

    GitHub Engineering mediumAdept

    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. The Ruby hooks ran as subprocesses under Git and loaded the Rails monolith's 450+ gems on every push, twice per push (quarantine and post-receive), so an empty push could take over two seconds. Pruning outlier dependencies found with a debugger and strace saved 350-400ms, but load time would creep back as the monolith grew. The rewrite instead passes the needed configuration through an existing per-push data mechanism and rolled out behind a feature flag.

  • Using Github Actions with Railway

    Railway mediumAdept

    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. A sample workflow triggers on pushes to main, checks out the code and uploads it to Railway. The token must stay secret, but the service ID can be passed openly. The same token approach also works for tasks like running database migrations before deploy or managing pull requests.

  • How we ship GitHub Mobile every week

    GitHub Engineering mediumAdept

    GitHub Mobile ships weekly iOS and Android releases using a single GitHub Actions workflow that runs every Saturday. It runs four jobs: create a release branch, then build, test, archive and upload to TestFlight via fastlane. It also opens a tracking issue that serves as a release playbook, assigned to the on-call release captain fetched from PagerDuty. The remaining jobs open PRs for raw changelogs (turned into human-written release notes) and for bumping the version number on main. On Monday the captain follows the issue checklist to ship to beta. Hotfixes are cherry-picked into the release branch, which triggers automated rebuilds, and the App Store release goes out after a week of clean beta metrics.

  • Simple trick to save environment and money when using GitHub Actions

    Turso mediumAdept

    GitHub Actions keeps running workflows for outdated pull request commits until they finish or fail. That wastes runner time, money on private repos, and quota on open source ones. Adding a `concurrency` block keyed on workflow name and PR number (falling back to the ref) with `cancel-in-progress: true` makes GitHub cancel stale runs when a PR is updated. In the first week after this change, 56 runs were cancelled in the LibSQL repository.

  • How We Fixed the Dependency Confusion Vulnerability in Over 600 Ruby Applications

    Shopify Engineering mediumAdept

    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. A custom Bundler plugin did the upgrade without changing dependency versions: it allowed only patch updates during regeneration, then restored the original versions. A CLI running on top of CI gave each repository its own environment, ran the migrations in parallel and opened pull requests automatically. Shopify also failed CI on outdated Bundler versions and worked with the Bundler maintainers on changes that shipped in 2.2.21 and 2.2.22, the latter preventing lockfiles from regressing to the old format.

The quest for software engineering knowledge.

Look:
Layout: