Skip to content

Commit b9cdb7f

Browse files
committed
Merge tag 'github-api-1.325' into release/v1.x
github-api-1.325
2 parents c602aa5 + 90e1b6f commit b9cdb7f

File tree

23 files changed

+8789
-38
lines changed

23 files changed

+8789
-38
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jobs:
4141
# 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
4242

4343
steps:
44+
- name: Set up JDK
45+
uses: actions/setup-java@v2
46+
with:
47+
distribution: 'temurin'
48+
java-version: 17
49+
4450
- name: Checkout repository
4551
uses: actions/checkout@v4
4652

.github/workflows/maven-build.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ jobs:
6060
run: mvn -B clean site -D enable-ci --file pom.xml
6161
test:
6262
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
63+
# Does not require build output, but orders execution to prevent launching test workflows when simple build fails
64+
needs: build
6365
runs-on: ${{ matrix.os }}-latest
6466
strategy:
6567
fail-fast: false
6668
matrix:
6769
os: [ ubuntu, windows ]
68-
java: [ 11, 17 ]
70+
java: [ 17, 21 ]
6971
steps:
7072
- uses: actions/checkout@v4
7173
- name: Set up JDK
@@ -128,3 +130,22 @@ jobs:
128130
cache: 'maven'
129131
- name: Maven Test (no build) Java 8
130132
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt
133+
134+
test-java-11:
135+
name: test Java 11 (no-build)
136+
needs: build
137+
runs-on: ubuntu-latest
138+
steps:
139+
- uses: actions/checkout@v4
140+
- uses: actions/download-artifact@v4
141+
with:
142+
name: maven-target-directory
143+
path: target
144+
- name: Set up JDK
145+
uses: actions/setup-java@v4
146+
with:
147+
java-version: 8
148+
distribution: 'temurin'
149+
cache: 'maven'
150+
- name: Maven Test (no build) Java 11
151+
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt

pom.xml

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.kohsuke</groupId>
44
<artifactId>github-api</artifactId>
5-
<version>1.324</version>
5+
<version>1.325</version>
66
<name>GitHub API for Java</name>
77
<url>https://github-api.kohsuke.org/</url>
88
<description>GitHub API for Java</description>
@@ -32,11 +32,12 @@
3232
</distributionManagement>
3333

3434
<properties>
35+
<spring.boot.version>3.3.3</spring.boot.version>
3536
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3637
<spotbugs-maven-plugin.version>4.8.6.1</spotbugs-maven-plugin.version>
3738
<spotbugs.version>4.8.6</spotbugs.version>
3839
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
39-
<hamcrest.version>2.2</hamcrest.version>
40+
<hamcrest.version>3.0</hamcrest.version>
4041
<okhttp3.version>4.12.0</okhttp3.version>
4142
<okio.version>3.9.0</okio.version>
4243
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
@@ -84,12 +85,12 @@
8485
<plugin>
8586
<groupId>org.codehaus.mojo</groupId>
8687
<artifactId>versions-maven-plugin</artifactId>
87-
<version>2.16.2</version>
88+
<version>2.17.1</version>
8889
</plugin>
8990
<plugin>
9091
<groupId>org.apache.maven.plugins</groupId>
9192
<artifactId>maven-help-plugin</artifactId>
92-
<version>3.4.0</version>
93+
<version>3.5.0</version>
9394
</plugin>
9495
<plugin>
9596
<artifactId>maven-surefire-plugin</artifactId>
@@ -222,7 +223,7 @@
222223
<plugin>
223224
<groupId>org.apache.maven.plugins</groupId>
224225
<artifactId>maven-javadoc-plugin</artifactId>
225-
<version>3.7.0</version>
226+
<version>3.8.0</version>
226227
<configuration>
227228
<release>8</release>
228229
<failOnWarnings>true</failOnWarnings>
@@ -240,33 +241,27 @@
240241
<autoReleaseAfterClose>true</autoReleaseAfterClose>
241242
</configuration>
242243
</plugin>
243-
<plugin>
244-
<groupId>org.codehaus.mojo</groupId>
245-
<artifactId>animal-sniffer-maven-plugin</artifactId>
246-
<version>1.22</version>
247-
<configuration>
248-
<signature>
249-
<groupId>org.codehaus.mojo.signature</groupId>
250-
<artifactId>java18</artifactId>
251-
<version>1.0</version>
252-
</signature>
253-
<ignores>
254-
java.net.http.*
255-
</ignores>
256-
</configuration>
257-
<executions>
258-
<execution>
259-
<id>ensure-java-1.8-class-library</id>
260-
<phase>test</phase>
261-
<goals>
262-
<goal>check</goal>
263-
</goals>
264-
</execution>
265-
</executions>
266-
</plugin>
267244
</plugins>
268245
</pluginManagement>
269246
<plugins>
247+
<!--
248+
This plugin is used to generate AOT metadata during tests so that it can be
249+
compared against those in META-INF/native-image/org.kohsuke/github-api/*.
250+
The tests are located in src/test/java/org.kohsuke.aot
251+
-->
252+
<plugin>
253+
<groupId>org.springframework.boot</groupId>
254+
<artifactId>spring-boot-maven-plugin</artifactId>
255+
<version>${spring.boot.version}</version>
256+
<executions>
257+
<execution>
258+
<id>process-test-aot</id>
259+
<goals>
260+
<goal>process-test-aot</goal>
261+
</goals>
262+
</execution>
263+
</executions>
264+
</plugin>
270265
<plugin>
271266
<groupId>org.apache.maven.plugins</groupId>
272267
<artifactId>maven-site-plugin</artifactId>
@@ -275,7 +270,7 @@
275270
<plugin>
276271
<groupId>org.apache.maven.plugins</groupId>
277272
<artifactId>maven-release-plugin</artifactId>
278-
<version>3.1.0</version>
273+
<version>3.1.1</version>
279274
<configuration>
280275
<autoVersionSubmodules>true</autoVersionSubmodules>
281276
<useReleaseProfile>false</useReleaseProfile>
@@ -290,7 +285,7 @@
290285
<plugin>
291286
<groupId>org.apache.maven.plugins</groupId>
292287
<artifactId>maven-project-info-reports-plugin</artifactId>
293-
<version>3.6.1</version>
288+
<version>3.7.0</version>
294289
<dependencies>
295290
<dependency>
296291
<groupId>org.apache.bcel</groupId>
@@ -472,7 +467,7 @@
472467
<dependency>
473468
<groupId>com.fasterxml.jackson</groupId>
474469
<artifactId>jackson-bom</artifactId>
475-
<version>2.17.1</version>
470+
<version>2.17.2</version>
476471
<scope>import</scope>
477472
<type>pom</type>
478473
</dependency>
@@ -497,6 +492,16 @@
497492
<version>${hamcrest.version}</version>
498493
<scope>test</scope>
499494
</dependency>
495+
<!--
496+
This plugin is used to start a spring boot application during tests
497+
to generate AOT metadata. See also spring-boot-maven-plugin
498+
-->
499+
<dependency>
500+
<groupId>org.springframework.boot</groupId>
501+
<artifactId>spring-boot-starter-test</artifactId>
502+
<version>${spring.boot.version}</version>
503+
<scope>test</scope>
504+
</dependency>
500505
<!-- This is needed in order to force junit4 and JTH tests to use newer hamcrest version -->
501506
<dependency>
502507
<groupId>org.hamcrest</groupId>
@@ -525,7 +530,14 @@
525530
<dependency>
526531
<groupId>org.awaitility</groupId>
527532
<artifactId>awaitility</artifactId>
528-
<version>4.2.1</version>
533+
<version>4.2.2</version>
534+
<scope>test</scope>
535+
</dependency>
536+
<!-- junit vintage engine is used because junit4 and junit5 tests are required -->
537+
<dependency>
538+
<groupId>org.junit.vintage</groupId>
539+
<artifactId>junit-vintage-engine</artifactId>
540+
<version>5.10.2</version>
529541
<scope>test</scope>
530542
</dependency>
531543
<dependency>
@@ -535,7 +547,7 @@
535547
<dependency>
536548
<groupId>commons-io</groupId>
537549
<artifactId>commons-io</artifactId>
538-
<version>2.8.0</version>
550+
<version>2.16.1</version>
539551
</dependency>
540552
<dependency>
541553
<groupId>com.infradna.tool</groupId>
@@ -629,7 +641,7 @@
629641
<dependency>
630642
<groupId>org.mockito</groupId>
631643
<artifactId>mockito-core</artifactId>
632-
<version>4.11.0</version>
644+
<version>5.13.0</version>
633645
<scope>test</scope>
634646
</dependency>
635647
<dependency>
@@ -653,7 +665,7 @@
653665
<dependency>
654666
<groupId>org.slf4j</groupId>
655667
<artifactId>slf4j-simple</artifactId>
656-
<version>2.0.13</version>
668+
<version>2.0.16</version>
657669
<scope>test</scope>
658670
</dependency>
659671
</dependencies>

src/main/java/org/kohsuke/github/GHLicense.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class GHLicense extends GHObject {
4949

5050
/** The name. */
5151
// these fields are always present, even in the short form
52-
protected String key, name;
52+
protected String key, name, spdxId;
5353

5454
/** The featured. */
5555
// the rest is only after populated
@@ -85,6 +85,15 @@ public String getName() {
8585
return name;
8686
}
8787

88+
/**
89+
* Gets SPDX ID.
90+
*
91+
* @return the spdx id
92+
*/
93+
public String getSpdxId() {
94+
return spdxId;
95+
}
96+
8897
/**
8998
* Featured licenses are bold in the new repository drop-down.
9099
*

src/main/java/org/kohsuke/github/GHRepository.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,6 +3685,21 @@ public PagedIterable<GHRepositoryRule> listRulesForBranch(String branch) throws
36853685
.toIterable(GHRepositoryRule[].class, null);
36863686
}
36873687

3688+
/**
3689+
* Check, if vulnerability alerts are enabled for this repository
3690+
* (https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#check-if-vulnerability-alerts-are-enabled-for-a-repository).
3691+
*
3692+
* @return true, if vulnerability alerts are enabled
3693+
* @throws IOException
3694+
* the io exception
3695+
*/
3696+
public boolean isVulnerabilityAlertsEnabled() throws IOException {
3697+
return root().createRequest()
3698+
.method("GET")
3699+
.withUrlPath(getApiTailUrl("/vulnerability-alerts"))
3700+
.fetchHttpStatusCode() == 204;
3701+
}
3702+
36883703
/**
36893704
* A {@link GHRepositoryBuilder} that allows multiple properties to be updated per request.
36903705
*

src/main/java/org/kohsuke/github/GHUser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ public Optional<String> getLdapDn() throws IOException {
275275
* on error
276276
*/
277277
public Date getSuspendedAt() throws IOException {
278+
super.populate();
278279
return GitHubClient.parseDate(suspendedAt);
279280
}
280281

0 commit comments

Comments
 (0)