Skip to content

Map branch and pull-request runs

Use this setup when you want to compare merged code with proposed changes. As a workspace owner or admin, open Project settings → Environments. You’ll create the two rules below. Use the name of your own long-lived branch in place of main.

Tab Example name Label Pattern Include in combined success rate
Branches Main baseline MAIN ^main$ On
Pull requests PRs into main PR-MAIN ^main$ Off
  1. In Branches, enter the first row’s name and label. Enter ^main$ in Branch patterns, turn on Include in combined success rate, and select Create environment.
  2. Switch to Pull requests and create the second row. Here the field is Target branch patterns. Leave this environment out of the combined rate if you want that number to describe merged code.
  3. If you have overlapping patterns in either tab, give the more specific environment a lower Priority number. Patterns are case-sensitive regular expressions, one per line. The anchors in ^main$ match the whole branch name. Use separate lines for alternatives such as ^main$ and ^stable$.
  4. Open Runs and check a reported CI push to main and a PR targeting main. Look for MAIN and PR-MAIN, respectively. Allow a few minutes for existing CI runs to show their new labels.

Once the labels look right, you can enable selection for PRs into main under Project settings → AI → Target environments. The branch baseline can continue running the full suite.

If a PR gets an unexpected label, check the reported PR number and target branch. For a stacked PR, also check the base branch of the stack. GitHub Actions detects these from the workflow event. In custom CI, pass pullRequestNumber, pullRequestTargetBranch, and the source branch to the reporter. For a stack, also pass pullRequestStackBaseBranch. Environment matching rules · Reporter settings