Quality Gates on Pull Requests

By Syncfusion®, Inc. · Last updated

Add lint, type check and test gates, give each its own job, lock the merge button with branch protection, and stop AI agent pull requests from hiding failures.

What you will learn

  • Add lint and type check steps
  • Split gates into one job each
  • Require checks with branch protection
  • Spot and remove continue-on-error on gates
  • Set rules for AI agent pull requests

Quality Gates on Pull Requests

Quality gate = a check a change must pass before it can merge.

In this lesson you add three gates and lock the merge button:

  • lint for style rules.
  • type check for wrong types.
  • tests for wrong behaviour.
  • branch protection so nobody can skip them.

Simple lesson: a gate only protects you if it is required and nobody can hide a failure.

A Real-World Example

Think about a school exam hall.

  • The guard checks your hall ticket.
  • The guard checks you have no phone.
  • The invigilator checks your signature.
  • If any check fails, you do not enter.

Now map it:

  • Each check = one quality gate.
  • The door = the merge button.
  • A guard who looks away = a hidden failure.

Simple lesson: three small checks catch more than one big check.

Three Gates

Lint

Lint = a tool that checks style and simple mistakes.

  • Finds unused variables, missing semicolons, bad spacing.
  • Fast: about a minute.
  • React: npm run lint (ESLint). .NET: dotnet format --verify-no-changes.

Type Check

Type check = making sure every value has the right type.

  • Catches "text where a number should be".
  • React: npx tsc --noEmit.
  • .NET: the compiler does it. -warnaserror also turns warnings into errors.

Tests

  • Tests check what the code does.
  • Lint and types cannot tell you if the price math is right.
  • Only a test can.

The Testing & Verification course teaches how to write tests that really catch bugs.

Run the same three commands on your laptop before you push. The pipeline is the safety net, not the first check.

Simple lesson: lint finds sloppy code, types find wrong data, tests find wrong behaviour.

One Check per Job

You can put all three in one job. Or one job each.

One job each is better on a pull request:

  • Each gate shows as its own line on the pull request.
  • You see at once which gate failed.
  • They run side by side, so it is faster.

Simple lesson: one job per gate gives a clear, named check on the pull request.

Branch Protection

A check that fails but can still be merged is only a warning.

Branch protection = rules that lock the merge button on main.

The two rules that matter most:

  • Require status checks to pass: pick lint, typecheck and test.
  • Require a review: a person must approve.
PlatformWhere it lives
GitHubSettings → Branches (or Rules) → main
Azure ReposBranch policies → main → Build validation

Real tools vs this lab: branch protection is a setting in GitHub or Azure Repos, not a line in the YAML file. In this lab, the switches above act like those settings.

Simple lesson: checks find problems. Branch protection makes them matter.

Gating AI Agent Pull Requests

AI coding agents open pull requests too. They need the same gates, or stricter ones.

Watch out for this trick:

  • A test fails.
  • Someone adds continue-on-error: true (Azure: continueOnError: true).
  • The step is still red inside, but the job turns green.
  • The pull request looks safe. It is not.

Rules for agent pull requests:

  • The pipeline file can only change with a human review.
  • No continue-on-error on lint, type check or tests.
  • Required checks apply to agents too. No exceptions.

Search your pipeline files for continue-on-error and continueOnError. Each one should have a clear reason next to it. On a test step, there is almost never a good reason.

Simple lesson: a green check means nothing if a failure inside it was hidden.

  1. In GitHub, open Settings → Rules → Rulesets (or Branches) for your starter repo.
  2. Protect main: require a pull request, and require the lint, typecheck and test checks.
  3. Open a pull request that breaks a lint rule.

What you should see: the merge button is blocked until the checks pass.

Quick Check

Cheat Sheet

GateReact + TypeScriptASP.NET Core
Lintnpm run lintdotnet format --verify-no-changes
Type checknpx tsc --noEmitdotnet build --no-restore -warnaserror
Testsnpm testdotnet test --no-restore

GitHub Actions, three gates:

on:
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm run lint
  typecheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx tsc --noEmit
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm test

Common mistakes

MistakeWrong ideaCorrect ideaWhat goes wrong
Checks not requiredA red check blocks mergeOnly required checks block itRed pull requests get merged
continue-on-error on testsIt keeps the pipeline movingIt hides real failuresBroken code looks green
Only tests, no type checkTests cover everythingTypes catch a different kind of bugType errors slip into main
One giant jobSimpler is betterSeparate jobs name the failureHard to see what broke
Agents skip reviewThe agent ran the testsThe pipeline can be changed by the agentGates get turned off quietly

What to Remember

  • Lint, type check, tests: three different nets.
  • One job per gate gives clear, named checks.
  • Required checks plus review lock the merge button.
  • continue-on-error on a gate = no gate.
  • Agent pull requests get the same gates, and a human review for pipeline changes.

Exercises

Next: Tests and Workflow Logic