You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actionable guidance when a commit email is not linked to GitHub
When a commit author's email does not map to any GitHub user, the
action can't tell whether that contributor has signed the CLA. Before:
the PR comment buried this as a one-line aside ('Alice seems not to
be a GitHub user. You need a GitHub account...'), which leaves the
contributor unsure what to actually do.
Now: the PR comment includes a dedicated '> [!WARNING]' block that
spells out the exact email address(es) that failed to match, and
gives two concrete remediation paths:
1. Link the email at github.com/settings/emails. (One-click fix if
the contributor already has a GitHub account.)
2. Rewrite the commits using an address that is already linked,
with the exact git rebase command included.
Implementation:
- graphql.ts now preserves the commit author's email when the commit
is not linked to a GitHub user, by extending Committer with an
optional 'email' field. Deduplication now keys on (id, email, name)
so two different unlinked addresses produce two entries but two
commits from the same unlinked address collapse.
- pullRequestCommentContent.ts extracts renderUnlinkedCommitBlock(),
which renders the new warning block. The existing 'not a GitHub
user' aside is removed.
Tests:
- commentContent unit: one unlinked / multiple unlinked / missing
email fallback.
- scenarios integration: PR with a commit by 'typo@example.com' (no
login) produces a bot comment containing the warning block, the
email, and both remediation options.
text += `**${names}** ${seem} not to be a GitHub user.`;
31001
-
text += ` You need a GitHub account to be able to sign the ${mode.label}. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/>`;
30995
+
text += renderUnlinkedCommitBlock(mode, committerMap.unknown);
31002
30996
}
31003
30997
if (input.suggestRecheck()) {
31004
30998
text +=
@@ -31010,6 +31004,51 @@ function renderPending(mode, committerMap) {
31010
31004
function botSignature(mode) {
31011
31005
return `<sub>Posted by the **${mode.botName}**.</sub>`;
31012
31006
}
31007
+
/**
31008
+
* Renders the "commit author email isn't linked to a GitHub account" block.
31009
+
* Shown both inline (when mixed with signed/unsigned committers) and as the
31010
+
* sole body (when every committer is unlinked — in which case this is the
31011
+
* only actionable thing in the comment).
31012
+
*/
31013
+
function renderUnlinkedCommitBlock(mode, unlinked) {
31014
+
const plural = unlinked.length > 1;
31015
+
const verb = plural ? 'were' : 'was';
31016
+
const commits = plural ? 'commits' : 'commit';
31017
+
// Render each unlinked identity as "name <email>" when we have an email to
31018
+
// show, otherwise just the name. Wrap email in backticks so Markdown does
> ${unlinked.length} ${commits} in this PR ${verb} authored by an email address that is not linked to any GitHub user, so we cannot tell whether the author has signed the ${mode.label}.
31030
+
>
31031
+
> Unlinked author${plural ? 's' : ''}:
31032
+
>
31033
+
> ${identityLines.replace(/\n/g, '\n> ')}
31034
+
>
31035
+
> **To unblock this PR, do one of the following:**
31036
+
>
31037
+
> 1. **Link the email to your GitHub account** (recommended). Add each address above at [github.com/settings/emails](https://github.com/settings/emails), then push another commit (or comment \`recheck\`) so this check re-runs. See [why commits are not linked to a user](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user) for details.
31038
+
>
31039
+
> 2. **Rewrite the commits** to use an email that is already linked to your GitHub account:
31040
+
>
31041
+
> \`\`\`bash
31042
+
> # Set the correct email locally (one-off, for this repo):
31043
+
> git config user.email you@example.com
31044
+
> # Rewrite every commit on this branch with the corrected identity:
text+=`**${names}** ${seem} not to be a GitHub user.`
76
-
text+=` You need a GitHub account to be able to sign the ${mode.label}. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/>`
> ${unlinked.length}${commits} in this PR ${verb} authored by an email address that is not linked to any GitHub user, so we cannot tell whether the author has signed the ${mode.label}.
118
+
>
119
+
> Unlinked author${plural ? 's' : ''}:
120
+
>
121
+
> ${identityLines.replace(/\n/g,'\n> ')}
122
+
>
123
+
> **To unblock this PR, do one of the following:**
124
+
>
125
+
> 1. **Link the email to your GitHub account** (recommended). Add each address above at [github.com/settings/emails](https://github.com/settings/emails), then push another commit (or comment \`recheck\`) so this check re-runs. See [why commits are not linked to a user](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user) for details.
126
+
>
127
+
> 2. **Rewrite the commits** to use an email that is already linked to your GitHub account:
128
+
>
129
+
> \`\`\`bash
130
+
> # Set the correct email locally (one-off, for this repo):
131
+
> git config user.email you@example.com
132
+
> # Rewrite every commit on this branch with the corrected identity:
0 commit comments