Skip to content

Azure DevOps: commitlint on pull requests

Add after npm ci in azure-pipelines.yml, PR builds only:

- bash: |
    git fetch origin main
    npx commitlint \
      --config library-maintenance/config/commitlint.config.mjs \
      --from origin/main \
      --to HEAD
  displayName: Lint commit messages
  condition: eq(variables['Build.Reason'], 'PullRequest')

Ensure package.json includes:

"lint:commits": "commitlint --config library-maintenance/config/commitlint.config.mjs --from origin/main --to HEAD"

Local husky enforcement remains the first line of defence; this step is the CI backstop for contributors who skip hooks.

When transplanting to an Azure DevOps port (e.g. engineering-library-prm), copy the full pipeline plan from that repo's docs/planning/azure-devops-pr-ci.md.