The GitHub Actions workflow is blocked because a required pull request review has not been approved.
Common Causes and Fixes
-
No Reviewers Assigned or Reviewers Haven’t Acted: The most frequent culprit is that a required reviewer simply hasn’t been assigned or hasn’t gotten around to approving the PR. GitHub’s protection rules are strict; if a review is mandated, the system waits indefinitely until it’s satisfied.
- Diagnosis: Navigate to the Pull Request on GitHub. Look under the "Code reviews" section. If no one has reviewed, or if a review is pending, this is your issue. You can also check your repository’s
Settings > Code and automation > Pull requeststo see the exact rules. - Fix: Manually assign reviewers if none are present, or ping the assigned reviewers. For example, on the PR page, click "Add requested reviewers" and select the appropriate individuals or teams. If reviewers have already submitted a review but it’s not an approval (e.g., "Request changes"), they need to change their review status to "Approve".
- Why it works: This directly satisfies the condition set by the branch protection rule. The system sees an approval from a required reviewer and unblocks the workflow.
- Diagnosis: Navigate to the Pull Request on GitHub. Look under the "Code reviews" section. If no one has reviewed, or if a review is pending, this is your issue. You can also check your repository’s
-
Reviewers Approved, but Changes Were Requested Later: A reviewer initially approved, but then requested changes. The PR status reverts to needing approval until the requested changes are addressed and the reviewer re-approves.
- Diagnosis: On the Pull Request, check the "Code reviews" section. If you see a "Request changes" status from a required reviewer, even if there was a prior "Approved" status, this is the cause.
- Fix: Make the requested changes, push new commits to the branch, and then ask the reviewer who requested changes to re-approve the PR.
- Why it works: The branch protection rule is designed to ensure that all outstanding review comments are addressed and formally approved. Re-requesting approval after changes are made fulfills this requirement.
-
Required Approving Stale Reviews: Some branch protection rules are configured to dismiss stale pull request approvals when new commits are pushed. If a reviewer approved an older version of the PR, and then new code was added, that approval might be considered "stale" and no longer counts towards the requirement.
- Diagnosis: In your repository’s
Settings > Code and automation > Pull requests, look for the option "Dismiss stale pull request approvals when new commits are pushed." If it’s checked, and you see an approval from before the last batch of commits, this is likely the issue. - Fix: Have a required reviewer re-approve the PR after the latest commits have been pushed.
- Why it works: This rule ensures that reviewers are always signing off on the most current version of the code, preventing outdated approvals from unblocking merges.
- Diagnosis: In your repository’s
-
Incorrect Reviewer/Team Configuration: The branch protection rule might be targeting a specific reviewer or team that doesn’t actually have the authority or the correct configuration to provide approvals for that branch. This could be a typo in a username, an incorrect team name, or a team that hasn’t been granted repository access.
- Diagnosis:
- Verify the exact username or team name in the branch protection rule (
Settings > Code and automation > Pull requests > Branch protection rules > Edit). - Check the repository’s
Settings > Accessto ensure the specified team has at least "Read" access, and ideally "Write" or "Maintain" access to the repository. - For teams, confirm the team members are correct and that the team itself is correctly linked to the organization.
- Verify the exact username or team name in the branch protection rule (
- Fix: Correct any typos in the reviewer/team name within the branch protection rule. Ensure the specified team has the necessary permissions for the repository. If it’s a team, verify its membership and correct configuration within the organization.
- Why it works: Ensures that the required approval comes from an entity that is both correctly identified by the rule and has the technical capability to submit an approval that GitHub recognizes.
- Diagnosis:
-
Required Approving Status Checks Failing: Sometimes, the branch protection rule requires not just a review, but also that certain status checks (like CI builds, linters, etc.) have passed. If these checks are failing, the PR will be blocked, even if reviews are approved.
- Diagnosis: On the Pull Request page, look at the "Checks" tab. If any required checks are red (failed) or are still running, this is the issue. The branch protection rule will usually list these required checks.
- Fix: Address the failures in the CI/CD pipeline or other integrated services. Fix the code that is causing the checks to fail, push the changes, and wait for the checks to pass.
- Why it works: This ensures code quality and functionality are met before a review is even considered sufficient for merging. The system verifies that all automated quality gates are green.
-
Multiple Required Reviews Not Met: The rule might require a certain number of distinct approvals (e.g., "Require at least 2 approvals"). If only one person has approved, or if the same person approved twice (which only counts as one distinct approval), the rule won’t be satisfied.
- Diagnosis: Check the branch protection rule for the specific number of required approvals. Then, on the PR, count the number of unique users who have approved.
- Fix: Get additional required reviewers to approve the Pull Request until the minimum number specified in the rule is met.
- Why it works: This enforces a consensus-based approach, ensuring that multiple stakeholders have validated the changes before they are merged.
The next error you might encounter is a "merge conflict" if the branch protection rules are correctly satisfied but the PR has diverged significantly from the target branch.