From f29f4231b25748b3f5d29d1ad2a2d91d5af8af11 Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Thu, 13 Feb 2025 07:45:22 +0000
Subject: [PATCH 01/18] Prepare for next development iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 594083c3b8..c9a50487fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.327
+ 1.328-SNAPSHOT
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From bfade2274aa132d6c48f1a769e6675e7f36d1bf7 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Wed, 23 Jul 2025 16:29:17 -0700
Subject: [PATCH 02/18] Chore(deps): Bump org.apache.commons:commons-lang3 from
3.17.0 to 3.18.0 (#2114)
Bumps org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0.
---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
dependency-version: 3.18.0
dependency-type: direct:production
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c9a50487fe..5a9511b313 100644
--- a/pom.xml
+++ b/pom.xml
@@ -486,7 +486,7 @@
org.apache.commons
commons-lang3
- 3.17.0
+ 3.18.0
com.tngtech.archunit
From a9a5f73160e616b6efd99c56c0c59fd1ce9a1a5d Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Wed, 23 Jul 2025 23:44:05 +0000
Subject: [PATCH 03/18] Prepare release (bitwiseman): github-api-1.328
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 5a9511b313..58c35fb8c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.328-SNAPSHOT
+ 1.328
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From 9033e4bea871508cc514fc9cdd404a7bfbb61799 Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Wed, 23 Jul 2025 23:44:09 +0000
Subject: [PATCH 04/18] Prepare for next development iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 58c35fb8c1..276fb917cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.328
+ 1.329-SNAPSHOT
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From 36c57655176099066f7d336edfc38f48f8b91c77 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Tue, 29 Jul 2025 11:29:45 -0700
Subject: [PATCH 05/18] Update ossrh sonatype staging url
ossrh sunsetted as of June 30, 2025:
https://central.sonatype.org/pages/ossrh-eol/
---
pom.xml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 276fb917cb..1f4207376e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,12 +18,12 @@
sonatype-nexus-snapshots
Sonatype Nexus Snapshots
- https://s01.oss.sonatype.org/content/repositories/snapshots/
+ ${nexus.serverUrl}/content/repositories/snapshots/
sonatype-nexus-staging
Nexus Release Repository
- https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+ ${nexus.serverUrl}/service/local/staging/deploy/maven2/
github-pages
@@ -49,6 +49,9 @@
+
+
+ https://ossrh-staging-api.central.sonatype.com
From 231226059fd3b4512228049d118bf6c97d42fb6a Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Tue, 29 Jul 2025 10:56:27 -0700
Subject: [PATCH 06/18] Update release tag workflow to support 1.x and 2.x
---
.../workflows/create_release_tag_and_pr.yml | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/create_release_tag_and_pr.yml b/.github/workflows/create_release_tag_and_pr.yml
index 16a59223f5..a959995177 100644
--- a/.github/workflows/create_release_tag_and_pr.yml
+++ b/.github/workflows/create_release_tag_and_pr.yml
@@ -21,11 +21,13 @@ jobs:
distribution: 'temurin'
cache: 'maven'
- - name: Reset staging/main
+ - name: Reset staging
id: staging
run: |
- git checkout -B staging/main
- git push --set-upstream -f origin staging/main
+ git checkout -B staging/$GITHUB_REF_NAME
+ git push --set-upstream -f origin staging/$GITHUB_REF_NAME
+ env:
+ GITHUB_REF_NAME: ${{ github.ref_name }}
- name: Set Release Version
id: release
@@ -37,7 +39,7 @@ jobs:
with:
commit_message: "Prepare release (${{ github.actor }}): github-api-${{ steps.release.outputs.version }}"
tagging_message: 'github-api-${{ steps.release.outputs.version }}'
- branch: staging/main
+ branch: staging/${{ github.ref_name }}
- name: Increment Snapshot Version
run: |
@@ -46,12 +48,12 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Prepare for next development iteration"
- branch: staging/main
+ branch: staging/${{ github.ref_name }}
- - name: pull-request to main
+ - name: Create pull-request
uses: repo-sync/pull-request@v2
with:
pr_title: "Prepare release (${{ github.actor }}): github-api-${{ steps.release.outputs.version }}"
- source_branch: "staging/main"
- destination_branch: "main"
+ source_branch: "staging/${{ github.ref_name }}"
+ destination_branch: "${{ github.ref_name }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
From b33c8ed7cb450224182f8b01a25e2631758b4dff Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Tue, 29 Jul 2025 18:45:01 +0000
Subject: [PATCH 07/18] Prepare release (bitwiseman): github-api-1.329
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 1f4207376e..0799d1e66a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.329-SNAPSHOT
+ 1.329
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From a41abd62cbd8208460ee8b2c2e6b4de845e8fd68 Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Tue, 29 Jul 2025 18:45:06 +0000
Subject: [PATCH 08/18] Prepare for next development iteration
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0799d1e66a..882174c13e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.329
+ 1.330-SNAPSHOT
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From e9152d88fff20a26301d6a543a73f7300c28e0be Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Tue, 29 Jul 2025 12:34:07 -0700
Subject: [PATCH 09/18] Update pom.xml
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 882174c13e..6108628704 100644
--- a/pom.xml
+++ b/pom.xml
@@ -240,7 +240,7 @@
true
sonatype-nexus-staging
- https://oss.sonatype.org/
+ ${nexus.serverUrl}/
true
From a1f3fd56b67358a54c3b7316d4b2f632fe447c40 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Tue, 2 Sep 2025 12:31:12 -0700
Subject: [PATCH 10/18] fix: remove usage of a deprecated constant. (#2138)
This change requires Jackson or later. This change is technically breaking
but 5+ years old.
FasterXML/jackson-databind@9f97baa
Fixes #2137
---
pom.xml | 2 +-
src/main/java/org/kohsuke/github/GitHubClient.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6108628704..6c49705e54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -478,7 +478,7 @@
com.fasterxml.jackson
jackson-bom
- 2.18.2
+ 2.20.0
import
pom
diff --git a/src/main/java/org/kohsuke/github/GitHubClient.java b/src/main/java/org/kohsuke/github/GitHubClient.java
index d40fcf3c1f..bc5f848aa7 100644
--- a/src/main/java/org/kohsuke/github/GitHubClient.java
+++ b/src/main/java/org/kohsuke/github/GitHubClient.java
@@ -89,7 +89,7 @@ class GitHubClient {
MAPPER.setVisibility(new VisibilityChecker.Std(NONE, NONE, NONE, NONE, ANY));
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MAPPER.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true);
- MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
+ MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
}
/**
From 6bf1ad69c1df8bf8dac28694e022b7c8cb083043 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Thu, 4 Sep 2025 10:14:40 -0700
Subject: [PATCH 11/18] Update workflows and readme
---
.github/PULL_REQUEST_TEMPLATE.md | 2 +-
.github/workflows/codeql-analysis.yml | 4 ++--
.../workflows/create_release_tag_and_pr.yml | 8 +++----
.github/workflows/maven-build.yml | 24 +++++++++----------
.github/workflows/publish_release_branch.yml | 16 ++++++-------
.gitignore | 1 +
README.md | 2 +-
7 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 0815906c23..2ffe6c4da9 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -8,7 +8,7 @@
- [ ] Add JavaDocs and other comments explaining the behavior.
- [ ] When adding or updating methods that fetch entities, add `@link` JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .
- [ ] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
-- [ ] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
+- [ ] Run `mvn -D enable-ci clean install site "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"` locally. If this command doesn't succeed, your change will not pass CI.
- [ ] Push your changes to a branch other than `main`. You will create your PR from that branch.
# When creating a PR:
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index ebb0d6b9c8..1f4364ff27 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -42,13 +42,13 @@ jobs:
steps:
- name: Set up JDK
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Checkout repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v5
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
diff --git a/.github/workflows/create_release_tag_and_pr.yml b/.github/workflows/create_release_tag_and_pr.yml
index a959995177..ec67d46e4b 100644
--- a/.github/workflows/create_release_tag_and_pr.yml
+++ b/.github/workflows/create_release_tag_and_pr.yml
@@ -10,12 +10,12 @@ jobs:
create_release_tag:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Maven Central Repository
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
@@ -35,7 +35,7 @@ jobs:
mvn -B versions:set versions:commit -DremoveSnapshot
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- - uses: stefanzweifel/git-auto-commit-action@v5
+ - uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "Prepare release (${{ github.actor }}): github-api-${{ steps.release.outputs.version }}"
tagging_message: 'github-api-${{ steps.release.outputs.version }}'
@@ -45,7 +45,7 @@ jobs:
run: |
mvn versions:set versions:commit -DnextSnapshot
- - uses: stefanzweifel/git-auto-commit-action@v5
+ - uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "Prepare for next development iteration"
branch: staging/${{ github.ref_name }}
diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 019b655490..3ddb6393ff 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -25,9 +25,9 @@ jobs:
strategy:
fail-fast: true
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Set up JDK
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'temurin'
@@ -47,9 +47,9 @@ jobs:
strategy:
fail-fast: false
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Set up JDK
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'temurin'
@@ -71,9 +71,9 @@ jobs:
os: [ ubuntu, windows ]
java: [ 17, 21 ]
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Set up JDK
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
@@ -101,13 +101,13 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - uses: actions/download-artifact@v4
+ - uses: actions/checkout@v5
+ - uses: actions/download-artifact@v5
with:
name: maven-test-target-directory
path: target
- name: Codecov Report
- uses: codecov/codecov-action@v5.1.2
+ uses: codecov/codecov-action@v5.5.0
with:
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
token: ${{ secrets.CODECOV_TOKEN }}
@@ -138,13 +138,13 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
- - uses: actions/download-artifact@v4
+ - uses: actions/checkout@v5
+ - uses: actions/download-artifact@v5
with:
name: maven-target-directory
path: target
- name: Set up JDK
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: 11
distribution: 'temurin'
diff --git a/.github/workflows/publish_release_branch.yml b/.github/workflows/publish_release_branch.yml
index 6e3041a436..b57db51098 100644
--- a/.github/workflows/publish_release_branch.yml
+++ b/.github/workflows/publish_release_branch.yml
@@ -12,9 +12,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Set up Maven Central Repository
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
@@ -35,9 +35,9 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Set up Maven Central Repository
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
@@ -55,13 +55,13 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSPHRASE }}
-
+
publish_gh_pages:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/release/v2.x' }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
with:
fetch-depth: 0
@@ -70,7 +70,7 @@ jobs:
run: |
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- - uses: actions/download-artifact@v4
+ - uses: actions/download-artifact@v5
with:
name: maven-release-target-directory
path: target
@@ -82,7 +82,7 @@ jobs:
cp -r ./target/site/* ./
- name: Publish GH Pages
- uses: stefanzweifel/git-auto-commit-action@v5
+ uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "Release (${{ github.actor }}): v${{ steps.release.outputs.version }}"
branch: gh-pages
diff --git a/.gitignore b/.gitignore
index 543ce576cd..5a585eb651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ target
.classpath
.project
.settings/
+.metadata/
.DS_Store
dependency-reduced-pom.xml
diff --git a/README.md b/README.md
index 76474f45b4..db22e163bb 100644
--- a/README.md
+++ b/README.md
@@ -6,4 +6,4 @@
[](https://codecov.io/gh/hub4j/github-api)
-See https://github-api.kohsuke.org/ for more details
+See https://hub4j.github.io/github-api/ for more details
From fa40aa30f6bd33ee0540d735f033af022e5569af Mon Sep 17 00:00:00 2001
From: bitwiseman <1958953+bitwiseman@users.noreply.github.com>
Date: Thu, 4 Sep 2025 17:39:21 +0000
Subject: [PATCH 12/18] Prepare release (bitwiseman): github-api-1.330
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 6c49705e54..f82340ebe0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.kohsuke
github-api
- 1.330-SNAPSHOT
+ 1.330
GitHub API for Java
https://github-api.kohsuke.org/
GitHub API for Java
From 5be461583763f8589ca82bb54a4c495f6b9db808 Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 11:45:48 +0400
Subject: [PATCH 13/18] Apply Spotless formatting
---
.../java/org/kohsuke/github/GHBranch.java | 10 +-
.../java/org/kohsuke/github/GHCommit.java | 71 ++---
.../kohsuke/github/GHEnvironmentVariable.java | 7 +-
.../github/GHPullRequestSearchBuilder.java | 16 +-
src/main/java/org/kohsuke/github/GHRule.java | 284 +++++++++---------
5 files changed, 195 insertions(+), 193 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java
index 492f7e75b8..e0641805e2 100644
--- a/src/main/java/org/kohsuke/github/GHBranch.java
+++ b/src/main/java/org/kohsuke/github/GHBranch.java
@@ -111,11 +111,11 @@ public GHBranchProtection getProtection() throws IOException {
return root().createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class);
}
- public PagedIterable getRules() throws IOException {
- return root().createRequest()
- .withUrlPath(owner.getApiTailUrl("rules/branches/" + name))
- .toIterable(GHRule[].class, GHRule::wrap);
- }
+ public PagedIterable getRules() throws IOException {
+ return root().createRequest()
+ .withUrlPath(owner.getApiTailUrl("rules/branches/" + name))
+ .toIterable(GHRule[].class, GHRule::wrap);
+ }
/**
* Gets sha 1.
diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java
index a6d9322568..10e89392df 100644
--- a/src/main/java/org/kohsuke/github/GHCommit.java
+++ b/src/main/java/org/kohsuke/github/GHCommit.java
@@ -350,40 +350,43 @@ public GHRepository getOwner() {
return owner;
}
- /**
- * Gets commit verification.
- * @return
- */
- public GHVerification getVerification() {
- return commit.getVerification();
- }
-
- /**
- * Gets commit author.
- * @return
- */
- public GitUser getCommitAuthor() {
- return commit.getAuthor();
- }
-
- /**
- * Gets commit committer.
- * @return
- */
- public GitUser getCommitCommitter() {
- return commit.getCommitter();
- }
-
- /**
- * Gets message.
- *
- * @return the commit message
- * @throws IOException
- * the io exception
- */
- public String getMessage() throws IOException {
- return getCommitShortInfo().getMessage();
- }
+ /**
+ * Gets commit verification.
+ *
+ * @return
+ */
+ public GHVerification getVerification() {
+ return commit.getVerification();
+ }
+
+ /**
+ * Gets commit author.
+ *
+ * @return
+ */
+ public GitUser getCommitAuthor() {
+ return commit.getAuthor();
+ }
+
+ /**
+ * Gets commit committer.
+ *
+ * @return
+ */
+ public GitUser getCommitCommitter() {
+ return commit.getCommitter();
+ }
+
+ /**
+ * Gets message.
+ *
+ * @return the commit message
+ * @throws IOException
+ * the io exception
+ */
+ public String getMessage() throws IOException {
+ return getCommitShortInfo().getMessage();
+ }
/**
* Gets lines changed.
*
diff --git a/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java b/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
index dbf7fbb583..2b678a05c7 100644
--- a/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
+++ b/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
@@ -1,8 +1,9 @@
package org.kohsuke.github;
-import javax.annotation.Nonnull;
import java.io.IOException;
+import javax.annotation.Nonnull;
+
public class GHEnvironmentVariable extends GitHubInteractiveObject {
private String name;
@@ -42,7 +43,9 @@ public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
- static GHEnvironmentVariable read(@Nonnull GHRepository repository, @Nonnull String environment, @Nonnull String name) throws IOException {
+ static GHEnvironmentVariable read(@Nonnull GHRepository repository,
+ @Nonnull String environment,
+ @Nonnull String name) throws IOException {
String url = "environments/" + environment + "/variables/" + name;
GHEnvironmentVariable variable = repository.root()
.createRequest()
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestSearchBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestSearchBuilder.java
index 630a2d9cd8..ee15191642 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestSearchBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestSearchBuilder.java
@@ -469,14 +469,14 @@ public enum Sort {
UPDATED,
/** The relevance. */
RELEVANCE,
- /**
- * https://docs.github.com/en/enterprise-cloud@latest/search-github/getting-started-with-searching-on-github/sorting-search-results#sort-by-author-date
- */
- AUTHOR_DATE,
- /**
- * https://docs.github.com/en/enterprise-cloud@latest/search-github/getting-started-with-searching-on-github/sorting-search-results#sort-by-committer-date
- */
- COMMITTER_DATE,
+ /**
+ * https://docs.github.com/en/enterprise-cloud@latest/search-github/getting-started-with-searching-on-github/sorting-search-results#sort-by-author-date
+ */
+ AUTHOR_DATE,
+ /**
+ * https://docs.github.com/en/enterprise-cloud@latest/search-github/getting-started-with-searching-on-github/sorting-search-results#sort-by-committer-date
+ */
+ COMMITTER_DATE,
}
private static class PullRequestSearchResult extends SearchResult {
diff --git a/src/main/java/org/kohsuke/github/GHRule.java b/src/main/java/org/kohsuke/github/GHRule.java
index e0ddd3a3c7..0bb39a8d51 100644
--- a/src/main/java/org/kohsuke/github/GHRule.java
+++ b/src/main/java/org/kohsuke/github/GHRule.java
@@ -5,148 +5,144 @@
import java.util.Collection;
public class GHRule {
- private RuleType type;
- private Parameters parameters;
-
- public RuleType getType() {
- return type;
- }
-
- public void setType(RuleType type) {
- this.type = type;
- }
-
- public Parameters getParameters() {
- return parameters;
- }
-
- public void setParameters(Parameters parameters) {
- this.parameters = parameters;
- }
-
-
- public GHRule wrap() {
- return this;
- }
-
- public enum RuleType {
- commit_author_email_pattern,
- copilot_code_review,
- creation,
- deletion,
- merge_queue,
- non_fast_forward,
- pull_request,
- require_code_scanning,
- require_deployments,
- require_linear_history,
- required_signatures,
- required_status_checks,
- update,
-
- // Fallback for any rule type GitHub introduces in the future that this client
- // does not yet know about. Combined with READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
- // in GitHubClient's ObjectMapper, this prevents deserialization failures on
- // new rule types and lets callers safely ignore them.
- @JsonEnumDefaultValue
- unknown,
- }
-
- public static class Parameters {
- private Collection required_status_checks;
- private MergeMethod merge_method;
- private Integer max_entries_to_build;
- private Integer min_entries_to_merge;
- private Integer max_entries_to_merge;
- private Integer min_entries_to_merge_wait_minutes;
- private Integer check_response_timeout_minutes;
- private GroupingStrategy grouping_strategy;
-
- public Collection getRequiredStatusChecks() {
- return required_status_checks;
- }
-
- public void setRequiredStatusChecks(Collection required_status_checks) {
- this.required_status_checks = required_status_checks;
- }
-
- public MergeMethod getMergeMethod() {
- return merge_method;
- }
-
- public void setMergeMethod(MergeMethod merge_method) {
- this.merge_method = merge_method;
- }
-
- public Integer getMaxEntriesToBuild() {
- return max_entries_to_build;
- }
-
- public void setMaxEntriesToBuild(Integer maxEntriesToBuild) {
- this.max_entries_to_build = maxEntriesToBuild;
- }
-
- public Integer getMinEntriesToMerge() {
- return min_entries_to_merge;
- }
-
- public void setMinEntriesToMerge(Integer minEntriesToMerge) {
- this.min_entries_to_merge = minEntriesToMerge;
- }
-
- public Integer getMaxEntriesToMerge() {
- return max_entries_to_merge;
- }
-
- public void setMaxEntriesToMerge(Integer maxEntriesToMerge) {
- this.max_entries_to_merge = maxEntriesToMerge;
- }
-
- public Integer getMinEntriesToMergeWaitMinutes() {
- return min_entries_to_merge_wait_minutes;
- }
-
- public void setMinEntriesToMergeWaitMinutes(Integer minEntriesToMergeWaitMinutes) {
- this.min_entries_to_merge_wait_minutes = minEntriesToMergeWaitMinutes;
- }
-
- public Integer getCheckResponseTimeoutMinutes() {
- return check_response_timeout_minutes;
- }
-
- public void setCheckResponseTimeoutMinutes(Integer checkResponseTimeoutMinutes) {
- this.check_response_timeout_minutes = checkResponseTimeoutMinutes;
- }
-
- public GroupingStrategy getGroupingStrategy() {
- return grouping_strategy;
- }
-
- public void setGroupingStrategy(GroupingStrategy groupingStrategy) {
- this.grouping_strategy = groupingStrategy;
- }
- }
-
- public static class RequiredCheck {
- private String context;
-
- public String getContext() {
- return context;
- }
-
- public void setContext(String context) {
- this.context = context;
- }
- }
-
- public enum MergeMethod {
- MERGE,
- SQUASH,
- REBASE
- }
-
- public enum GroupingStrategy {
- ALLGREEN,
- HEADGREEN
- }
+ private RuleType type;
+ private Parameters parameters;
+
+ public RuleType getType() {
+ return type;
+ }
+
+ public void setType(RuleType type) {
+ this.type = type;
+ }
+
+ public Parameters getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Parameters parameters) {
+ this.parameters = parameters;
+ }
+
+ public GHRule wrap() {
+ return this;
+ }
+
+ public enum RuleType {
+ commit_author_email_pattern,
+ copilot_code_review,
+ creation,
+ deletion,
+ merge_queue,
+ non_fast_forward,
+ pull_request,
+ require_code_scanning,
+ require_deployments,
+ require_linear_history,
+ required_signatures,
+ required_status_checks,
+ update,
+
+ // Fallback for any rule type GitHub introduces in the future that this client
+ // does not yet know about. Combined with READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
+ // in GitHubClient's ObjectMapper, this prevents deserialization failures on
+ // new rule types and lets callers safely ignore them.
+ @JsonEnumDefaultValue
+ unknown,
+ }
+
+ public static class Parameters {
+ private Collection required_status_checks;
+ private MergeMethod merge_method;
+ private Integer max_entries_to_build;
+ private Integer min_entries_to_merge;
+ private Integer max_entries_to_merge;
+ private Integer min_entries_to_merge_wait_minutes;
+ private Integer check_response_timeout_minutes;
+ private GroupingStrategy grouping_strategy;
+
+ public Collection getRequiredStatusChecks() {
+ return required_status_checks;
+ }
+
+ public void setRequiredStatusChecks(Collection required_status_checks) {
+ this.required_status_checks = required_status_checks;
+ }
+
+ public MergeMethod getMergeMethod() {
+ return merge_method;
+ }
+
+ public void setMergeMethod(MergeMethod merge_method) {
+ this.merge_method = merge_method;
+ }
+
+ public Integer getMaxEntriesToBuild() {
+ return max_entries_to_build;
+ }
+
+ public void setMaxEntriesToBuild(Integer maxEntriesToBuild) {
+ this.max_entries_to_build = maxEntriesToBuild;
+ }
+
+ public Integer getMinEntriesToMerge() {
+ return min_entries_to_merge;
+ }
+
+ public void setMinEntriesToMerge(Integer minEntriesToMerge) {
+ this.min_entries_to_merge = minEntriesToMerge;
+ }
+
+ public Integer getMaxEntriesToMerge() {
+ return max_entries_to_merge;
+ }
+
+ public void setMaxEntriesToMerge(Integer maxEntriesToMerge) {
+ this.max_entries_to_merge = maxEntriesToMerge;
+ }
+
+ public Integer getMinEntriesToMergeWaitMinutes() {
+ return min_entries_to_merge_wait_minutes;
+ }
+
+ public void setMinEntriesToMergeWaitMinutes(Integer minEntriesToMergeWaitMinutes) {
+ this.min_entries_to_merge_wait_minutes = minEntriesToMergeWaitMinutes;
+ }
+
+ public Integer getCheckResponseTimeoutMinutes() {
+ return check_response_timeout_minutes;
+ }
+
+ public void setCheckResponseTimeoutMinutes(Integer checkResponseTimeoutMinutes) {
+ this.check_response_timeout_minutes = checkResponseTimeoutMinutes;
+ }
+
+ public GroupingStrategy getGroupingStrategy() {
+ return grouping_strategy;
+ }
+
+ public void setGroupingStrategy(GroupingStrategy groupingStrategy) {
+ this.grouping_strategy = groupingStrategy;
+ }
+ }
+
+ public static class RequiredCheck {
+ private String context;
+
+ public String getContext() {
+ return context;
+ }
+
+ public void setContext(String context) {
+ this.context = context;
+ }
+ }
+
+ public enum MergeMethod {
+ MERGE, SQUASH, REBASE
+ }
+
+ public enum GroupingStrategy {
+ ALLGREEN, HEADGREEN
+ }
}
From 5ee843dc3ee25fede82b7e2a2a1d1ea62254f977 Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 11:52:06 +0400
Subject: [PATCH 14/18] Suppress SpotBugs warnings for GHRule
---
src/main/java/org/kohsuke/github/GHRule.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main/java/org/kohsuke/github/GHRule.java b/src/main/java/org/kohsuke/github/GHRule.java
index 0bb39a8d51..13bef7fdd1 100644
--- a/src/main/java/org/kohsuke/github/GHRule.java
+++ b/src/main/java/org/kohsuke/github/GHRule.java
@@ -1,6 +1,7 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
@@ -16,10 +17,12 @@ public void setType(RuleType type) {
this.type = type;
}
+ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public Parameters getParameters() {
return parameters;
}
+ @SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Expected behavior")
public void setParameters(Parameters parameters) {
this.parameters = parameters;
}
@@ -61,10 +64,12 @@ public static class Parameters {
private Integer check_response_timeout_minutes;
private GroupingStrategy grouping_strategy;
+ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public Collection getRequiredStatusChecks() {
return required_status_checks;
}
+ @SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Expected behavior")
public void setRequiredStatusChecks(Collection required_status_checks) {
this.required_status_checks = required_status_checks;
}
From 8266fb32662ee9fa66a007052e356ab328cbe531 Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 12:05:36 +0400
Subject: [PATCH 15/18] Fix CI warnings after upstream merge
---
.../java/org/kohsuke/github/GHBranch.java | 7 +
.../java/org/kohsuke/github/GHCommit.java | 6 +-
.../kohsuke/github/GHEnvironmentVariable.java | 53 +++++
.../github/GHPullRequestCommitDetail.java | 10 +
src/main/java/org/kohsuke/github/GHRule.java | 188 +++++++++++++++++-
.../java/org/kohsuke/github/EnumTest.java | 2 +-
6 files changed, 260 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java
index e0641805e2..0f297a61ca 100644
--- a/src/main/java/org/kohsuke/github/GHBranch.java
+++ b/src/main/java/org/kohsuke/github/GHBranch.java
@@ -111,6 +111,13 @@ public GHBranchProtection getProtection() throws IOException {
return root().createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class);
}
+ /**
+ * Lists rules configured for this branch.
+ *
+ * @return branch rules
+ * @throws IOException
+ * if an I/O error occurs
+ */
public PagedIterable getRules() throws IOException {
return root().createRequest()
.withUrlPath(owner.getApiTailUrl("rules/branches/" + name))
diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java
index 10e89392df..1cae2d7d07 100644
--- a/src/main/java/org/kohsuke/github/GHCommit.java
+++ b/src/main/java/org/kohsuke/github/GHCommit.java
@@ -353,7 +353,7 @@ public GHRepository getOwner() {
/**
* Gets commit verification.
*
- * @return
+ * @return the commit verification
*/
public GHVerification getVerification() {
return commit.getVerification();
@@ -362,7 +362,7 @@ public GHVerification getVerification() {
/**
* Gets commit author.
*
- * @return
+ * @return the commit author
*/
public GitUser getCommitAuthor() {
return commit.getAuthor();
@@ -371,7 +371,7 @@ public GitUser getCommitAuthor() {
/**
* Gets commit committer.
*
- * @return
+ * @return the commit committer
*/
public GitUser getCommitCommitter() {
return commit.getCommitter();
diff --git a/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java b/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
index 2b678a05c7..bb9fa2bf8b 100644
--- a/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
+++ b/src/main/java/org/kohsuke/github/GHEnvironmentVariable.java
@@ -4,6 +4,9 @@
import javax.annotation.Nonnull;
+/**
+ * Environment variable configured for a repository environment.
+ */
public class GHEnvironmentVariable extends GitHubInteractiveObject {
private String name;
@@ -11,34 +14,84 @@ public class GHEnvironmentVariable extends GitHubInteractiveObject {
private String createdAt;
private String updatedAt;
+ /**
+ * Creates an environment variable instance.
+ */
+ public GHEnvironmentVariable() {
+ }
+
+ /**
+ * Gets the variable name.
+ *
+ * @return the variable name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the variable name.
+ *
+ * @param name
+ * the variable name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Gets the variable value.
+ *
+ * @return the variable value
+ */
public String getValue() {
return value;
}
+ /**
+ * Sets the variable value.
+ *
+ * @param value
+ * the variable value
+ */
public void setValue(String value) {
this.value = value;
}
+ /**
+ * Gets the creation timestamp.
+ *
+ * @return the creation timestamp
+ */
public String getCreatedAt() {
return createdAt;
}
+ /**
+ * Sets the creation timestamp.
+ *
+ * @param createdAt
+ * the creation timestamp
+ */
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
+ /**
+ * Gets the update timestamp.
+ *
+ * @return the update timestamp
+ */
public String getUpdatedAt() {
return updatedAt;
}
+ /**
+ * Sets the update timestamp.
+ *
+ * @param updatedAt
+ * the update timestamp
+ */
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
index 4586ff788c..c14b497102 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
@@ -67,8 +67,16 @@ void wrapUp(GHPullRequest owner) {
public static class GHCommitDetailAuthor {
String login;
+ /**
+ * Creates a commit detail author instance.
+ */
+ public GHCommitDetailAuthor() {
+ }
+
/**
* GitHub user login
+ *
+ * @return the GitHub user login
*/
public String getLogin() {
return login;
@@ -335,6 +343,7 @@ public CommitPointer[] getParents() {
/**
* Gets the GitHub user - author of the commit.
*
+ * @return the commit author
*/
public GHCommitDetailAuthor getAuthor() {
return author;
@@ -343,6 +352,7 @@ public GHCommitDetailAuthor getAuthor() {
/**
* Gets the GitHub user - committer of the commit.
*
+ * @return the commit committer
*/
public GHCommitDetailAuthor getCommitter() {
return committer;
diff --git a/src/main/java/org/kohsuke/github/GHRule.java b/src/main/java/org/kohsuke/github/GHRule.java
index 13bef7fdd1..4d17bd59d3 100644
--- a/src/main/java/org/kohsuke/github/GHRule.java
+++ b/src/main/java/org/kohsuke/github/GHRule.java
@@ -5,55 +5,111 @@
import java.util.Collection;
+/**
+ * Rule configured for a repository branch.
+ */
public class GHRule {
private RuleType type;
private Parameters parameters;
+ /**
+ * Creates a branch rule instance.
+ */
+ public GHRule() {
+ }
+
+ /**
+ * Gets the rule type.
+ *
+ * @return the rule type
+ */
public RuleType getType() {
return type;
}
+ /**
+ * Sets the rule type.
+ *
+ * @param type
+ * the rule type
+ */
public void setType(RuleType type) {
this.type = type;
}
+ /**
+ * Gets the rule parameters.
+ *
+ * @return the rule parameters
+ */
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public Parameters getParameters() {
return parameters;
}
+ /**
+ * Sets the rule parameters.
+ *
+ * @param parameters
+ * the rule parameters
+ */
@SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Expected behavior")
public void setParameters(Parameters parameters) {
this.parameters = parameters;
}
+ /**
+ * Wraps this rule.
+ *
+ * @return this rule
+ */
public GHRule wrap() {
return this;
}
+ /**
+ * Branch rule type.
+ */
public enum RuleType {
+ /** Commit author email pattern rule. */
commit_author_email_pattern,
+ /** Copilot code review rule. */
copilot_code_review,
+ /** Creation rule. */
creation,
+ /** Deletion rule. */
deletion,
+ /** Merge queue rule. */
merge_queue,
+ /** Non fast-forward rule. */
non_fast_forward,
+ /** Pull request rule. */
pull_request,
+ /** Code scanning rule. */
require_code_scanning,
+ /** Deployment rule. */
require_deployments,
+ /** Linear history rule. */
require_linear_history,
+ /** Required signatures rule. */
required_signatures,
+ /** Required status checks rule. */
required_status_checks,
+ /** Update rule. */
update,
// Fallback for any rule type GitHub introduces in the future that this client
// does not yet know about. Combined with READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
// in GitHubClient's ObjectMapper, this prevents deserialization failures on
// new rule types and lets callers safely ignore them.
+ /** Unknown rule type. */
@JsonEnumDefaultValue
unknown,
}
+ /**
+ * Branch rule parameters.
+ */
public static class Parameters {
private Collection required_status_checks;
private MergeMethod merge_method;
@@ -64,90 +120,218 @@ public static class Parameters {
private Integer check_response_timeout_minutes;
private GroupingStrategy grouping_strategy;
+ /**
+ * Creates branch rule parameters.
+ */
+ public Parameters() {
+ }
+
+ /**
+ * Gets required status checks.
+ *
+ * @return required status checks
+ */
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public Collection getRequiredStatusChecks() {
return required_status_checks;
}
+ /**
+ * Sets required status checks.
+ *
+ * @param required_status_checks
+ * required status checks
+ */
@SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Expected behavior")
public void setRequiredStatusChecks(Collection required_status_checks) {
this.required_status_checks = required_status_checks;
}
+ /**
+ * Gets the merge method.
+ *
+ * @return the merge method
+ */
public MergeMethod getMergeMethod() {
return merge_method;
}
+ /**
+ * Sets the merge method.
+ *
+ * @param merge_method
+ * the merge method
+ */
public void setMergeMethod(MergeMethod merge_method) {
this.merge_method = merge_method;
}
+ /**
+ * Gets the maximum entries to build.
+ *
+ * @return the maximum entries to build
+ */
public Integer getMaxEntriesToBuild() {
return max_entries_to_build;
}
+ /**
+ * Sets the maximum entries to build.
+ *
+ * @param maxEntriesToBuild
+ * the maximum entries to build
+ */
public void setMaxEntriesToBuild(Integer maxEntriesToBuild) {
this.max_entries_to_build = maxEntriesToBuild;
}
+ /**
+ * Gets the minimum entries to merge.
+ *
+ * @return the minimum entries to merge
+ */
public Integer getMinEntriesToMerge() {
return min_entries_to_merge;
}
+ /**
+ * Sets the minimum entries to merge.
+ *
+ * @param minEntriesToMerge
+ * the minimum entries to merge
+ */
public void setMinEntriesToMerge(Integer minEntriesToMerge) {
this.min_entries_to_merge = minEntriesToMerge;
}
+ /**
+ * Gets the maximum entries to merge.
+ *
+ * @return the maximum entries to merge
+ */
public Integer getMaxEntriesToMerge() {
return max_entries_to_merge;
}
+ /**
+ * Sets the maximum entries to merge.
+ *
+ * @param maxEntriesToMerge
+ * the maximum entries to merge
+ */
public void setMaxEntriesToMerge(Integer maxEntriesToMerge) {
this.max_entries_to_merge = maxEntriesToMerge;
}
+ /**
+ * Gets the minimum entries to merge wait time in minutes.
+ *
+ * @return the minimum entries to merge wait time in minutes
+ */
public Integer getMinEntriesToMergeWaitMinutes() {
return min_entries_to_merge_wait_minutes;
}
+ /**
+ * Sets the minimum entries to merge wait time in minutes.
+ *
+ * @param minEntriesToMergeWaitMinutes
+ * the minimum entries to merge wait time in minutes
+ */
public void setMinEntriesToMergeWaitMinutes(Integer minEntriesToMergeWaitMinutes) {
this.min_entries_to_merge_wait_minutes = minEntriesToMergeWaitMinutes;
}
+ /**
+ * Gets the check response timeout in minutes.
+ *
+ * @return the check response timeout in minutes
+ */
public Integer getCheckResponseTimeoutMinutes() {
return check_response_timeout_minutes;
}
+ /**
+ * Sets the check response timeout in minutes.
+ *
+ * @param checkResponseTimeoutMinutes
+ * the check response timeout in minutes
+ */
public void setCheckResponseTimeoutMinutes(Integer checkResponseTimeoutMinutes) {
this.check_response_timeout_minutes = checkResponseTimeoutMinutes;
}
+ /**
+ * Gets the grouping strategy.
+ *
+ * @return the grouping strategy
+ */
public GroupingStrategy getGroupingStrategy() {
return grouping_strategy;
}
+ /**
+ * Sets the grouping strategy.
+ *
+ * @param groupingStrategy
+ * the grouping strategy
+ */
public void setGroupingStrategy(GroupingStrategy groupingStrategy) {
this.grouping_strategy = groupingStrategy;
}
}
+ /**
+ * Required check for a branch rule.
+ */
public static class RequiredCheck {
private String context;
+ /**
+ * Creates a required check instance.
+ */
+ public RequiredCheck() {
+ }
+
+ /**
+ * Gets the check context.
+ *
+ * @return the check context
+ */
public String getContext() {
return context;
}
+ /**
+ * Sets the check context.
+ *
+ * @param context
+ * the check context
+ */
public void setContext(String context) {
this.context = context;
}
}
+ /**
+ * Merge method for merge queue rules.
+ */
public enum MergeMethod {
- MERGE, SQUASH, REBASE
+ /** Merge commit method. */
+ MERGE,
+ /** Squash merge method. */
+ SQUASH,
+ /** Rebase merge method. */
+ REBASE
}
+ /**
+ * Grouping strategy for merge queue rules.
+ */
public enum GroupingStrategy {
- ALLGREEN, HEADGREEN
+ /** All entries must be green. */
+ ALLGREEN,
+ /** Head entry must be green. */
+ HEADGREEN
}
}
diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java
index 8458561428..bbc8ad4e76 100644
--- a/src/test/java/org/kohsuke/github/EnumTest.java
+++ b/src/test/java/org/kohsuke/github/EnumTest.java
@@ -100,7 +100,7 @@ public void touchEnums() {
assertThat(GHPullRequestReviewState.APPROVED.action(), equalTo(GHPullRequestReviewEvent.APPROVE.action()));
assertThat(GHPullRequestReviewState.DISMISSED.toEvent(), nullValue());
- assertThat(GHPullRequestSearchBuilder.Sort.values().length, equalTo(4));
+ assertThat(GHPullRequestSearchBuilder.Sort.values().length, equalTo(6));
assertThat(GHReleaseBuilder.MakeLatest.values().length, equalTo(3));
From e8c0220575ad0f0820c637af621bdddf1b0cf073 Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 12:19:19 +0400
Subject: [PATCH 16/18] Register fork classes for AOT
---
.../github-api/reflect-config.json | 120 ++++++++++++++++++
.../github-api/serialization-config.json | 24 ++++
2 files changed, 144 insertions(+)
diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json
index bf579ed21e..1a1a9f5cd1 100644
--- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json
+++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json
@@ -4229,6 +4229,21 @@
"allPublicClasses": true,
"allDeclaredClasses": true
},
+ {
+ "name": "org.kohsuke.github.GHPullRequestCommitDetail$GHCommitDetailAuthor",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
{
"name": "org.kohsuke.github.GHPullRequestCommitDetail$Commit",
"allPublicFields": true,
@@ -5354,6 +5369,21 @@
"allPublicClasses": true,
"allDeclaredClasses": true
},
+ {
+ "name": "org.kohsuke.github.GHEnvironmentVariable",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
{
"name": "org.kohsuke.github.GHRepositoryVariable",
"allPublicFields": true,
@@ -5474,6 +5504,96 @@
"allPublicClasses": true,
"allDeclaredClasses": true
},
+ {
+ "name": "org.kohsuke.github.GHRule",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$GroupingStrategy",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$MergeMethod",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$Parameters",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$RequiredCheck",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$RuleType",
+ "allPublicFields": true,
+ "allDeclaredFields": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredConstructors": true,
+ "allPublicConstructors": true,
+ "allDeclaredConstructors": true,
+ "queryAllPublicMethods": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredMethods": true,
+ "allPublicClasses": true,
+ "allDeclaredClasses": true
+ },
{
"name": "org.kohsuke.github.GHSearchBuilder",
"allPublicFields": true,
diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json
index ffe3790ded..6b88237b8c 100644
--- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json
+++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json
@@ -848,6 +848,9 @@
{
"name": "org.kohsuke.github.GHPullRequestCommitDetail"
},
+ {
+ "name": "org.kohsuke.github.GHPullRequestCommitDetail$GHCommitDetailAuthor"
+ },
{
"name": "org.kohsuke.github.GHPullRequestCommitDetail$Commit"
},
@@ -1073,6 +1076,9 @@
{
"name": "org.kohsuke.github.GHRepositoryTrafficTopReferralSources"
},
+ {
+ "name": "org.kohsuke.github.GHEnvironmentVariable"
+ },
{
"name": "org.kohsuke.github.GHRepositoryVariable$1"
},
@@ -1097,6 +1103,24 @@
{
"name": "org.kohsuke.github.GHRequestedAction"
},
+ {
+ "name": "org.kohsuke.github.GHRule"
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$GroupingStrategy"
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$MergeMethod"
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$Parameters"
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$RequiredCheck"
+ },
+ {
+ "name": "org.kohsuke.github.GHRule$RuleType"
+ },
{
"name": "org.kohsuke.github.GHSearchBuilder"
},
From c3ca6ccb19b8355016c9b61dfa3f8fc3a02bcd04 Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 12:44:45 +0400
Subject: [PATCH 17/18] Add coverage for fork rule models
---
.../github/GHEnvironmentVariableTest.java | 36 ++++++++
.../java/org/kohsuke/github/GHRuleTest.java | 89 +++++++++++++++++++
2 files changed, 125 insertions(+)
create mode 100644 src/test/java/org/kohsuke/github/GHEnvironmentVariableTest.java
create mode 100644 src/test/java/org/kohsuke/github/GHRuleTest.java
diff --git a/src/test/java/org/kohsuke/github/GHEnvironmentVariableTest.java b/src/test/java/org/kohsuke/github/GHEnvironmentVariableTest.java
new file mode 100644
index 0000000000..cdc9bafbb6
--- /dev/null
+++ b/src/test/java/org/kohsuke/github/GHEnvironmentVariableTest.java
@@ -0,0 +1,36 @@
+package org.kohsuke.github;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+/**
+ * Test class for GHEnvironmentVariable.
+ */
+public class GHEnvironmentVariableTest {
+
+ /**
+ * Create default GHEnvironmentVariableTest instance.
+ */
+ public GHEnvironmentVariableTest() {
+ }
+
+ /**
+ * Tests environment variable getters and setters.
+ */
+ @Test
+ public void testAccessors() {
+ GHEnvironmentVariable variable = new GHEnvironmentVariable();
+
+ variable.setName("name");
+ variable.setValue("value");
+ variable.setCreatedAt("created");
+ variable.setUpdatedAt("updated");
+
+ assertThat(variable.getName(), is("name"));
+ assertThat(variable.getValue(), is("value"));
+ assertThat(variable.getCreatedAt(), is("created"));
+ assertThat(variable.getUpdatedAt(), is("updated"));
+ }
+}
diff --git a/src/test/java/org/kohsuke/github/GHRuleTest.java b/src/test/java/org/kohsuke/github/GHRuleTest.java
new file mode 100644
index 0000000000..d1df4ec5ad
--- /dev/null
+++ b/src/test/java/org/kohsuke/github/GHRuleTest.java
@@ -0,0 +1,89 @@
+package org.kohsuke.github;
+
+import org.junit.Test;
+
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.sameInstance;
+
+/**
+ * Test class for GHRule.
+ */
+public class GHRuleTest {
+
+ /**
+ * Create default GHRuleTest instance.
+ */
+ public GHRuleTest() {
+ }
+
+ /**
+ * Tests rule getters and setters.
+ */
+ @Test
+ public void testRuleAccessors() {
+ GHRule rule = new GHRule();
+ GHRule.Parameters parameters = new GHRule.Parameters();
+
+ rule.setType(GHRule.RuleType.merge_queue);
+ rule.setParameters(parameters);
+
+ assertThat(rule.getType(), is(GHRule.RuleType.merge_queue));
+ assertThat(rule.getParameters(), is(sameInstance(parameters)));
+ assertThat(rule.wrap(), is(sameInstance(rule)));
+ }
+
+ /**
+ * Tests parameter getters and setters.
+ */
+ @Test
+ public void testParametersAccessors() {
+ GHRule.Parameters parameters = new GHRule.Parameters();
+ GHRule.RequiredCheck requiredCheck = new GHRule.RequiredCheck();
+
+ parameters.setRequiredStatusChecks(Collections.singleton(requiredCheck));
+ parameters.setMergeMethod(GHRule.MergeMethod.SQUASH);
+ parameters.setMaxEntriesToBuild(1);
+ parameters.setMinEntriesToMerge(2);
+ parameters.setMaxEntriesToMerge(3);
+ parameters.setMinEntriesToMergeWaitMinutes(4);
+ parameters.setCheckResponseTimeoutMinutes(5);
+ parameters.setGroupingStrategy(GHRule.GroupingStrategy.HEADGREEN);
+
+ assertThat(parameters.getRequiredStatusChecks(), is(equalTo(Collections.singleton(requiredCheck))));
+ assertThat(parameters.getMergeMethod(), is(GHRule.MergeMethod.SQUASH));
+ assertThat(parameters.getMaxEntriesToBuild(), is(1));
+ assertThat(parameters.getMinEntriesToMerge(), is(2));
+ assertThat(parameters.getMaxEntriesToMerge(), is(3));
+ assertThat(parameters.getMinEntriesToMergeWaitMinutes(), is(4));
+ assertThat(parameters.getCheckResponseTimeoutMinutes(), is(5));
+ assertThat(parameters.getGroupingStrategy(), is(GHRule.GroupingStrategy.HEADGREEN));
+ }
+
+ /**
+ * Tests required check accessors.
+ */
+ @Test
+ public void testRequiredCheckAccessors() {
+ GHRule.RequiredCheck requiredCheck = new GHRule.RequiredCheck();
+
+ requiredCheck.setContext("build");
+
+ assertThat(requiredCheck.getContext(), is("build"));
+ }
+
+ /**
+ * Tests rule enums.
+ */
+ @Test
+ public void testEnums() {
+ assertThat(GHRule.RuleType.values().length, is(14));
+ assertThat(GHRule.RuleType.unknown, is(notNullValue()));
+ assertThat(GHRule.MergeMethod.values().length, is(3));
+ assertThat(GHRule.GroupingStrategy.values().length, is(2));
+ }
+}
From 8714140545734a266df939304fee632029c5a1bf Mon Sep 17 00:00:00 2001
From: Yuri Titov
Date: Tue, 21 Jul 2026 13:17:58 +0400
Subject: [PATCH 18/18] Ignore codecov-upload in forked repo
---
.github/workflows/maven-build.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 3ddb6393ff..867a390089 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -98,6 +98,7 @@ jobs:
retention-days: 3
codecov-upload:
name: codecov-upload (Upload to codecov.io)
+ if: github.repository == 'hub4j/github-api'
needs: test
runs-on: ubuntu-latest
steps: