Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into main-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Sep 13, 2024
2 parents 0c408cf + 9e9e775 commit c359119
Show file tree
Hide file tree
Showing 235 changed files with 19,100 additions and 3,585 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17

- name: Checkout repository
uses: actions/checkout@v4

Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ jobs:
run: mvn -B clean site -D enable-ci --file pom.xml
test:
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
# Does not require build output, but orders execution to prevent launching test workflows when simple build fails
needs: build
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows ]
java: [ 11, 17 ]
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK
Expand Down Expand Up @@ -109,3 +111,22 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

test-java-11:
name: test Java 11 (no-build)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: maven-target-directory
path: target
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
cache: 'maven'
- name: Maven Test (no build) Java 11
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt
67 changes: 51 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
</distributionManagement>

<properties>
<spring.boot.version>3.3.3</spring.boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotbugs-maven-plugin.version>4.8.5.0</spotbugs-maven-plugin.version>
<spotbugs-maven-plugin.version>4.8.6.1</spotbugs-maven-plugin.version>
<spotbugs.version>4.8.6</spotbugs.version>
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
<hamcrest.version>2.2</hamcrest.version>
<hamcrest.version>3.0</hamcrest.version>
<okhttp3.version>4.12.0</okhttp3.version>
<okio.version>3.7.0</okio.version>
<okio.version>3.9.0</okio.version>
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
<jacoco.coverage.target.bundle.method>0.70</jacoco.coverage.target.bundle.method>
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
Expand Down Expand Up @@ -76,12 +77,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
<version>2.17.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.4.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -172,7 +173,6 @@
<exclude>org.kohsuke.github.GHCommit.GHAuthor</exclude>

<!-- TODO: Some coverage, but more needed -->
<exclude>org.kohsuke.github.GHPullRequestReviewBuilder.DraftReviewComment</exclude>
<exclude>org.kohsuke.github.GHIssue.PullRequest</exclude>
<exclude>org.kohsuke.github.GHCommitSearchBuilder</exclude>
<exclude>org.kohsuke.github.GHRepositorySearchBuilder</exclude>
Expand Down Expand Up @@ -205,7 +205,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
<configuration>
<release>11</release>
<failOnWarnings>true</failOnWarnings>
Expand All @@ -226,6 +226,24 @@
</plugins>
</pluginManagement>
<plugins>
<!--
This plugin is used to generate AOT metadata during tests so that it can be
compared against those in META-INF/native-image/org.kohsuke/github-api/*.
The tests are located in src/test/java/org.kohsuke.aot
-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<id>process-test-aot</id>
<goals>
<goal>process-test-aot</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
Expand All @@ -234,7 +252,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
Expand All @@ -249,7 +267,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.0</version>
<version>3.7.0</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
Expand Down Expand Up @@ -394,7 +412,7 @@
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>2.17.1</version>
<version>2.17.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -419,6 +437,16 @@
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<!--
This plugin is used to start a spring boot application during tests
to generate AOT metadata. See also spring-boot-maven-plugin
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
</dependency>
<!-- This is needed in order to force junit4 and JTH tests to use newer hamcrest version -->
<dependency>
<groupId>org.hamcrest</groupId>
Expand Down Expand Up @@ -447,7 +475,14 @@
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.1</version>
<version>4.2.2</version>
<scope>test</scope>
</dependency>
<!-- junit vintage engine is used because junit4 and junit5 tests are required -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -457,7 +492,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>com.infradna.tool</groupId>
Expand Down Expand Up @@ -504,13 +539,13 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>wordnet-random-name</artifactId>
<version>1.5</version>
<version>1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>
<version>5.13.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -528,13 +563,13 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.13</version>
<version>2.0.16</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
90 changes: 90 additions & 0 deletions src/main/java/org/kohsuke/github/GHBranchSync.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package org.kohsuke.github;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* The type Gh branch sync.
*/
public class GHBranchSync extends GitHubInteractiveObject {

/**
* The Repository that this branch is in.
*/
private GHRepository owner;

/**
* The message.
*/
private String message;

/**
* The merge type.
*/
private String mergeType;

/**
* The base branch.
*/
private String baseBranch;

/**
* Gets owner.
*
* @return the repository that this branch is in.
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHRepository getOwner() {
return owner;
}

/**
* Gets message.
*
* @return the message
*/
public String getMessage() {
return message;
}

/**
* Gets merge type.
*
* @return the merge type
*/
public String getMergeType() {
return mergeType;
}

/**
* Gets base branch.
*
* @return the base branch
*/
public String getBaseBranch() {
return baseBranch;
}

/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
return "GHBranchSync{" + "message='" + message + '\'' + ", mergeType='" + mergeType + '\'' + ", baseBranch='"
+ baseBranch + '\'' + '}';
}

/**
* Wrap.
*
* @param repo
* the repo
* @return the GH branch sync
*/
GHBranchSync wrap(GHRepository repo) {
this.owner = repo;
return this;
}

}
11 changes: 10 additions & 1 deletion src/main/java/org/kohsuke/github/GHLicense.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class GHLicense extends GHObject {

/** The name. */
// these fields are always present, even in the short form
protected String key, name;
protected String key, name, spdxId;

/** The featured. */
// the rest is only after populated
Expand Down Expand Up @@ -85,6 +85,15 @@ public String getName() {
return name;
}

/**
* Gets SPDX ID.
*
* @return the spdx id
*/
public String getSpdxId() {
return spdxId;
}

/**
* Featured licenses are bold in the new repository drop-down.
*
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,15 @@ public GHPullRequestReviewBuilder createReview() {
return new GHPullRequestReviewBuilder(this);
}

/**
* Create gh pull request review comment builder.
*
* @return the gh pull request review comment builder.
*/
public GHPullRequestReviewCommentBuilder createReviewComment() {
return new GHPullRequestReviewCommentBuilder(this);
}

/**
* Create review comment gh pull request review comment.
*
Expand All @@ -476,18 +485,12 @@ public GHPullRequestReviewBuilder createReview() {
* @return the gh pull request review comment
* @throws IOException
* the io exception
* @deprecated use {@link #createReviewComment()}
*/
@Deprecated
public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position)
throws IOException {
return root().createRequest()
.method("POST")
.with("body", body)
.with("commit_id", sha)
.with("path", path)
.with("position", position)
.withUrlPath(getApiRoute() + COMMENTS_ACTION)
.fetch(GHPullRequestReviewComment.class)
.wrapUp(this);
return createReviewComment().body(body).commitId(sha).path(path).position(position).create();
}

/**
Expand Down
Loading

0 comments on commit c359119

Please sign in to comment.