CI/CD Best Practices

Chapter 2 · Practice 4 of 4

Run the required checks before merge, not after

From Fast feedback and tests you can trust

Why it matters

DORA lists skipping tests before commit as a pitfall: trunk only stays stable if changes are tested before they land.

Configure the repository so this cannot be skipped:

  • Make the CI jobs required status checks on the main branch.
  • Require the branch to be up to date with main, or use a merge queue that tests the combined result.
  • Run the same checks on main after merge, to catch anything that only shows up in combination.

To check, open the branch protection or ruleset settings and confirm the test job names are listed as required.

Example

YAML
on:
  pull_request:
  push:
    branches: [main]
  merge_group: