Skip to content
shiporbreak

No streak yet

Sign in

October 31, 2026 路 #45

GitHub ActionsMediumOpen write-up

Two deploys, and the older one won

Two merges landed a minute apart. Production now runs the older commit. Which line should have prevented it?

name: deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./scripts/build.sh
      - run: ./scripts/deploy.sh production

Next puzzle in UTC

One try. The first answer sticks.

How to fix it

Each push starts its own run. Without a concurrency group they deploy in parallel, and whichever finishes last wins. Add a concurrency group for production.

GitHub Actions runs workflows in parallel by default. Commit A starts a run, commit B starts a run a minute later. If A's build is slower, perhaps because of a cold cache, A deploys after B and production quietly moves backwards. Nothing failed, so nothing alerts.

The bug is the trigger with no serialization. Line 4 is where every push to main becomes an independent deploy.

Fix

concurrency:
  group: deploy-production
  cancel-in-progress: false

With a group, only one run deploys at a time and newer pending runs replace older pending ones. Keep cancel-in-progress: false for deploys so a half-finished rollout is never killed mid-way. Environments with required reviewers add the same ordering plus a human gate.

Sponsor this spot

Put your tool on the puzzle
One labeled card, in front of engineers who show up every day from YouTube, TikTok, and Instagram.