Skip to content

Commit 857721e

Browse files
authored
[JENKINS-75704] Fix Copilot user null name/email handling (#864)
1 parent 77b6542 commit 857721e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,17 +2572,24 @@ public void observe(GHPullRequest pr) {
25722572
GHUser user = null;
25732573
try {
25742574
user = pr.getUser();
2575-
if (users.containsKey(user.getLogin())) {
2576-
// looked up this user already
2577-
user = users.get(user.getLogin());
2575+
String login = user.getLogin();
2576+
if ("copilot".equalsIgnoreCase(login)) {
2577+
ContributorMetadataAction contributor =
2578+
new ContributorMetadataAction("copilot", "copilot", "copilot@unknown.user");
2579+
pullRequestContributorCache.put(number, contributor);
2580+
users.put("copilot", user);
2581+
} else {
2582+
if (users.containsKey(login)) {
2583+
// looked up this user already
2584+
user = users.get(login);
2585+
}
2586+
ContributorMetadataAction contributor =
2587+
new ContributorMetadataAction(login, user.getName(), user.getEmail());
2588+
// store the populated user record now that we have it
2589+
pullRequestContributorCache.put(number, contributor);
2590+
users.put(login, user);
25782591
}
2579-
ContributorMetadataAction contributor =
2580-
new ContributorMetadataAction(user.getLogin(), user.getName(), user.getEmail());
2581-
pullRequestContributorCache.put(number, contributor);
2582-
// store the populated user record now that we have it
2583-
users.put(user.getLogin(), user);
25842592
} catch (FileNotFoundException e) {
2585-
// If file not found for user, warn but keep going
25862593
request.listener()
25872594
.getLogger()
25882595
.format(

0 commit comments

Comments
 (0)