Skip to content

Add conflict resolution shortcut icon to Mergeable column#266

Open
Copilot wants to merge 4 commits intomainfrom
copilot/add-conflict-icon-in-mergable-column
Open

Add conflict resolution shortcut icon to Mergeable column#266
Copilot wants to merge 4 commits intomainfrom
copilot/add-conflict-icon-in-mergable-column

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

PRs with merge conflicts have no quick action to notify contributors — maintainers must manually open the PR, compose a message, and tag the author.

Changes

  • Conflict icon button — when mergeable_state === 'dirty' (shown as "Conflicts"), an orange fa-comment-dots icon appears inline next to the label in the Mergeable column
  • Click behavior — clicking the icon:
    • Constructs a pre-filled @mention message: Hi @{author}, this PR has merge conflicts that need to be resolved before it can be merged. Could you please fix the conflicts? Thank you!
    • Opens the PR in a new tab with the comment box pre-filled via GitHub's ?expand=1&body=<encoded_message> URL parameter, so the maintainer can submit it with one click
    • Also copies the message to the clipboard as a convenience
    • Shows a green success toast confirming the action
  • showSuccessToast — new utility function mirroring the existing showError toast, using green styling
  • Input validationauthorLogin is validated against ^[a-zA-Z0-9_.-]+$ before being used in the @mention; falls back to "contributor" if invalid
  • Accessibility — button includes aria-label="Copy conflict message and open PR" and a descriptive title

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 1, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
blt-leaf d00b6b8 Commit Preview URL

Branch Preview URL
Mar 08 2026, 06:33 PM

Copilot AI changed the title [WIP] Add icon for resolving conflicts in mergeable column Add conflict resolution shortcut icon to Mergeable column Mar 1, 2026
@DonnieBLT
Copy link
Copy Markdown
Contributor

@copilot please make sure the github comment is pre-filled

Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot please make sure the github comment is pre-filled

Done in 45d0816. The PR is now opened with the comment pre-filled using GitHub's ?expand=1&body=<encoded_message> URL parameter — clicking the icon opens the PR directly with the conflict resolution message typed into the comment box, ready to submit. The message is also still copied to clipboard as a convenience.

@github-actions github-actions bot added the files-changed: 1 PR changes 1 file label Mar 1, 2026
@DonnieBLT DonnieBLT marked this pull request as ready for review March 8, 2026 18:33
Copilot AI review requested due to automatic review settings March 8, 2026 18:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a quick-action affordance in the PR list to help maintainers notify authors when a PR has merge conflicts, by exposing an inline “conflict message” shortcut in the Mergeable column.

Changes:

  • Added a green-styled global showSuccessToast utility (mirrors existing showError toast pattern).
  • Rendered an inline orange comment icon button next to the “Conflicts” mergeable state label.
  • Implemented click behavior to build a pre-filled conflict-resolution message, copy it to clipboard, and open the PR in a new tab with URL parameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2615 to +2628
conflictMessageBtn.addEventListener('click', async (e) => {
e.stopPropagation();
const prUrl = conflictMessageBtn.dataset.prUrl;
const authorLogin = conflictMessageBtn.dataset.authorLogin;
const authorMention = authorLogin && /^[a-zA-Z0-9_.-]+$/.test(authorLogin) ? `@${authorLogin}` : 'contributor';
const message = `Hi ${authorMention}, this PR has merge conflicts that need to be resolved before it can be merged. Could you please fix the conflicts? Thank you!`;
const prUrlWithComment = `${prUrl}?expand=1&body=${encodeURIComponent(message)}`;
try {
await navigator.clipboard.writeText(message);
showSuccessToast('Opening PR with conflict message pre-filled...');
} catch (err) {
console.error('Failed to copy conflict message:', err);
}
window.open(prUrlWithComment, '_blank', 'noopener,noreferrer');
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.open(...) is called after await navigator.clipboard.writeText(...). Awaiting an async operation can cause the browser to treat the later window.open as not being directly user-initiated, which may trigger popup blocking and break the shortcut. Open the new tab synchronously within the click handler (before awaiting), or avoid await by handling the clipboard promise without delaying the window.open call.

Suggested change
conflictMessageBtn.addEventListener('click', async (e) => {
e.stopPropagation();
const prUrl = conflictMessageBtn.dataset.prUrl;
const authorLogin = conflictMessageBtn.dataset.authorLogin;
const authorMention = authorLogin && /^[a-zA-Z0-9_.-]+$/.test(authorLogin) ? `@${authorLogin}` : 'contributor';
const message = `Hi ${authorMention}, this PR has merge conflicts that need to be resolved before it can be merged. Could you please fix the conflicts? Thank you!`;
const prUrlWithComment = `${prUrl}?expand=1&body=${encodeURIComponent(message)}`;
try {
await navigator.clipboard.writeText(message);
showSuccessToast('Opening PR with conflict message pre-filled...');
} catch (err) {
console.error('Failed to copy conflict message:', err);
}
window.open(prUrlWithComment, '_blank', 'noopener,noreferrer');
conflictMessageBtn.addEventListener('click', (e) => {
e.stopPropagation();
const prUrl = conflictMessageBtn.dataset.prUrl;
const authorLogin = conflictMessageBtn.dataset.authorLogin;
const authorMention = authorLogin && /^[a-zA-Z0-9_.-]+$/.test(authorLogin) ? `@${authorLogin}` : 'contributor';
const message = `Hi ${authorMention}, this PR has merge conflicts that need to be resolved before it can be merged. Could you please fix the conflicts? Thank you!`;
const prUrlWithComment = `${prUrl}?expand=1&body=${encodeURIComponent(message)}`;
// Open the PR in a new tab synchronously in response to the click
window.open(prUrlWithComment, '_blank', 'noopener,noreferrer');
// Copy the message to the clipboard without delaying the window.open call
navigator.clipboard.writeText(message)
.then(() => {
showSuccessToast('Opening PR with conflict message pre-filled...');
})
.catch((err) => {
console.error('Failed to copy conflict message:', err);
});

Copilot uses AI. Check for mistakes.
Comment on lines +2622 to +2627
try {
await navigator.clipboard.writeText(message);
showSuccessToast('Opening PR with conflict message pre-filled...');
} catch (err) {
console.error('Failed to copy conflict message:', err);
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success toast is only shown when navigator.clipboard.writeText succeeds. If clipboard access is denied/unavailable, the PR still opens but no toast is shown, which doesn’t match the described behavior of always confirming the action. Consider showing a success toast for the tab-open action regardless, and separately showing a warning/error toast if clipboard copy fails.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 1 PR changes 1 file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants