From e0dbccaa71746f967d440952be99ac9219b90a77 Mon Sep 17 00:00:00 2001 From: Roman Zabaluev Date: Tue, 2 Jun 2026 01:19:15 +0800 Subject: [PATCH] Add authorAssociation field and getter to GHIssue Deserialize the `author_association` field from the GitHub REST API on issues and pull requests. Uses the same String-field + EnumUtils pattern as GHIssueComment for forward-compatible enum parsing. --- src/main/java/org/kohsuke/github/GHIssue.java | 14 ++++++++++++++ src/test/java/org/kohsuke/github/GHIssueTest.java | 1 + 2 files changed, 15 insertions(+) diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java index e2d5e39bdb..2f9686ae22 100644 --- a/src/main/java/org/kohsuke/github/GHIssue.java +++ b/src/main/java/org/kohsuke/github/GHIssue.java @@ -121,6 +121,9 @@ protected static List getLogins(Collection users) { /** The assignees. */ protected GHUser[] assignees; + /** The author's association with the repository. */ + protected String authorAssociation; + /** The body. */ @SkipFromToString protected String body; @@ -349,6 +352,17 @@ public List getAssignees() { return Collections.unmodifiableList(Arrays.asList(assignees)); } + /** + * Gets the author's association with the repository. + * + * @return the author association + */ + public GHCommentAuthorAssociation getAuthorAssociation() { + return EnumUtils.getEnumOrDefault(GHCommentAuthorAssociation.class, + authorAssociation, + GHCommentAuthorAssociation.UNKNOWN); + } + /** * The description of this pull request. * diff --git a/src/test/java/org/kohsuke/github/GHIssueTest.java b/src/test/java/org/kohsuke/github/GHIssueTest.java index 6fdaf379bc..19f2a2bd1b 100644 --- a/src/test/java/org/kohsuke/github/GHIssueTest.java +++ b/src/test/java/org/kohsuke/github/GHIssueTest.java @@ -169,6 +169,7 @@ public void createIssue() throws Exception { GHRepository repo = getRepository(); GHIssue issue = repo.createIssue(name).body("## test").create(); assertThat(issue.getTitle(), equalTo(name)); + assertThat(issue.getAuthorAssociation(), equalTo(GHCommentAuthorAssociation.NONE)); } /**