Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/pr-review-needed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,25 @@ jobs:
continue;
}

// Fetch the full PR details to get mergeable_state (not available in list endpoint)
const { data: fullPr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number
});

// Check if PR has merge conflicts
const hasMergeConflict = pr.mergeable_state === 'dirty';
// mergeable_state can be: clean, dirty, blocked, behind, unstable, unknown, or null
// - 'dirty' definitely means conflicts
// - mergeable === false + not blocked/behind/unstable also likely means conflicts
// - blocked/behind/unstable mean the PR can't merge due to other reasons (checks, needs update, etc.)
const hasMergeConflict = fullPr.mergeable_state === 'dirty' ||
(fullPr.mergeable === false &&
fullPr.mergeable_state !== 'blocked' &&
fullPr.mergeable_state !== 'behind' &&
fullPr.mergeable_state !== 'unstable' &&
fullPr.mergeable_state !== 'unknown' &&
fullPr.mergeable_state !== 'clean');

// Get reviews to check if PR is approved
const reviews = await getAllPages(github.rest.pulls.listReviews, {
Expand Down