Skip to main content

Pull Request Verification

Run a CI job against the merge commit of a pull request to check how its changes work together with the target branch. A trigger starts the job; a branch protection rule makes a successful result mandatory for merging.

Run Verification for Source Changes​

  1. Define a job, for example Verify PR, with Checkout Code and the commands that test your project. Add a Pull request open or update trigger. Set Target Branches to main and Touched Files to src/**:

    triggers:
    - !PullRequestUpdateTrigger
    branches: main
    paths: src/**

    Replace the branch, path pattern, and job name with your project's values. Commit the build specification before testing the trigger.

  2. Open a pull request changing a file under src, or push another source change to an existing pull request. The job runs against the merge commit of the source and target branches. A documentation-only pull request outside src/** does not match this trigger.

    In this example, the source branch and target branch each supplied a file checked by the job:

    Successful merged-commit verification

Require a Successful Build​

A failed job alone does not prevent merging. To enforce it:

  1. Open Settings → Code → Branch Protection and add or edit the rule for main. Set Applicable Users to the users covered by the rule (for example, anyone). Ensure this is the first matching rule for those users and that it is enabled.

  2. Under File Protections, add Paths src/** and select Verify PR under Required Builds. Leave the branch-wide Required Builds empty if the requirement should apply only to these paths.

    File-scoped required build

  3. Save the rule. The pull request now identifies the job as required and blocks merging until it succeeds:

    Required failed build blocks merging

  4. Fix the source and push again. The trigger runs the job on the updated merge commit. Once required builds and any review requirements are satisfied, the pull request can merge.

With Require Strict Pull Request Builds enabled, a target-branch update can make an earlier successful build insufficient. The pull request then shows Jobs required to be successful on merge commit with a run button. Use that control to run verification against the new merge commit before merging.

Keep the trigger's path filter and the protection rule consistent: requiring a job for files that never trigger it can leave pull requests waiting for a manual build.