World map

 

BM: Baca dalam Bahasa Melayu

World C3: Release & Deploy

Environments with required reviewers

You will learn: how to make production wait for a person to say yes.

Checked with GitHub Actions 2026-10 on 31 Oct 2026

The problem

Pick an event. Press Run and watch the line.

Midnight: a push to main tests, then deploys at once.

What happened on GitHub

Workflow file .github/workflows/deploy.yml

name: Deploy
on:
push:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npm ci
- run: npm test
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: npm ci
- run: npm run deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

The line

Push to main · main

Midnight. A teammate pushes to main. The van leaves at once. Nobody tasted the food. Run it and watch.

Watch

Give production a guard. An environment: A named place you deploy to, like production, with its own secrets and rules. is a named place you deploy to. It has its own rules. Which of these are environment rules?

Drag a card into a box. Or tap the card, then tap the box.

      Try it

      Production now has a required reviewer: A person who must approve before a job deploys to an environment, like the head chef signing before the van leaves.: Aina. Run it. The deploy job waits. You are Aina: check it, then approve.

      Run it. When a job waits for you, check it and approve.

      What happened on GitHub

      Workflow file .github/workflows/deploy.yml

      name: Deploy
      on: push
      permissions:
      contents: read
      jobs:
      test:
      runs-on: ubuntu-latest
      steps:
      - uses: actions/checkout@v7
      - run: npm ci
      - run: npm test
      deploy:
      needs: test
      runs-on: ubuntu-latest
      environment:
      name: production
      url: https://shop.example.com
      steps:
      - uses: actions/checkout@v7
      - run: npm ci
      - run: npm run deploy
      env:
      CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
      

      The line

      Push to main · main

      Try it

      Now build it. A job joins an environment with one key: environment.

      Tap blocks to add them. Put them in order.

      Blocks

      Your workflow

      Tap a block above to start.

      Workflow file .github/workflows/

      name: Deploy
      

      What runs

      Nothing to run yet.

      Predict

      Someone pushes to the branch feature. Production allows only main. What happens to the deploy job?

      Pick one answer.

      Check

      Check it on the belt. Find the push the guard stops. Read the real message.

      Try the events. Find the one asked for.

      What happened on GitHub

      Workflow file .github/workflows/deploy.yml

      name: Deploy
      on: push
      permissions:
      contents: read
      jobs:
      test:
      runs-on: ubuntu-latest
      steps:
      - uses: actions/checkout@v7
      - run: npm ci
      - run: npm test
      deploy:
      needs: test
      runs-on: ubuntu-latest
      environment:
      name: production
      url: https://shop.example.com
      steps:
      - uses: actions/checkout@v7
      - run: npm ci
      - run: npm run deploy
      env:
      CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
      

      The line

      Push to main · main

      You did it!

      You can now put a human gate in front of production.

      Go deeper (optional)

      Up to six people or teams can be reviewers. One approval is enough. Turn on “prevent self-review” so nobody approves their own deploy. A wait timer can pause up to 30 days. On private repos, required reviewers need GitHub Enterprise.

      Real rep (optional): in a public test repo, make a production environment. Add yourself as its reviewer.