Sub topic 10
Reviewing changes with pull requests
This chapter assumes you know Git branches, commits and merges, and that you have a work item with committed changes from the previous chapter. A pull request (PR) is where a teammate checks that change before it joins the pipeline.
Where the pull request fits
Each work item has its own branch. When you commit changes, DevOps Center pushes them to that branch. A PR asks the repository to merge the work item branch into the branch for the first pipeline stage. Review happens in your Git provider, such as GitHub. DevOps Center creates the PR and tracks its state.
Creating the pull request
- Open the work item in DevOps Center.
- Check that the changes you committed are listed.
- Select the option to create a pull request.
- Add a short description of what changed and why.
The work item moves to a review status once the PR exists. The PR contains only that work item's commits, so keep work items small. A small PR is easier to read and less likely to conflict.
What a reviewer checks
Reviewers read the metadata diff, which is XML for most components. Look for these points:
- The change matches the work item description.
- No unrelated components were pulled in by tracking.
- Profiles and permission sets do not grant more access than intended.
- Apex has test coverage, and Flows have no hard-coded IDs.
- No environment-specific values are present, such as URLs or record IDs.
To see what a PR carries, compare the branches locally:
git fetch origin
git log --oneline origin/main..origin/UATThis lists commits that reached UAT but not main.
Completing the review
When the reviewer approves, you merge the PR. DevOps Center then marks the work item as ready to promote. If the reviewer asks for changes, commit more changes to the same work item. The PR updates on its own, because it points at the same branch.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| No PR option on the work item | No changes committed yet | Pull and commit changes first |
| PR shows unexpected files | Change tracking picked up extra components | Remove them from the commit and recommit |
| Merge blocked | Branch protection or conflict | Satisfy the rule or resolve the conflict |
| Reviewer cannot see the PR | Missing repository access | Grant access in the Git provider |
Exercise
A reviewer asks you to remove one Apex class from an open PR. What do you do, and why does the PR update without creating a new one?
Show answer
Remove the class from the work item's changes, commit again, and the new commit goes to the same work item branch. The PR is tied to that branch, so it picks up the new commit automatically.
Exercise
Name two things a reviewer should check in a permission set diff.
Show answer
That it does not grant broader object or field access than the work item needs, and that it contains no components unrelated to the work item.