Skip to content

Commit

Permalink
Merge tag 'github-api-1.325' into release/v1.x
Browse files Browse the repository at this point in the history
github-api-1.325
  • Loading branch information
bitwiseman committed Sep 13, 2024
2 parents c602aa5 + 90e1b6f commit b9cdb7f
Show file tree
Hide file tree
Showing 23 changed files with 8,789 additions and 38 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 @@ -128,3 +130,22 @@ jobs:
cache: 'maven'
- name: Maven Test (no build) Java 8
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt

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
84 changes: 48 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.324</version>
<version>1.325</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
Expand Down Expand Up @@ -32,11 +32,12 @@
</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.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.9.0</okio.version>
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
Expand Down Expand Up @@ -84,12 +85,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 @@ -222,7 +223,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>8</release>
<failOnWarnings>true</failOnWarnings>
Expand All @@ -240,33 +241,27 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.22</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<ignores>
java.net.http.*
</ignores>
</configuration>
<executions>
<execution>
<id>ensure-java-1.8-class-library</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</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 @@ -275,7 +270,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 @@ -290,7 +285,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.1</version>
<version>3.7.0</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
Expand Down Expand Up @@ -472,7 +467,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 @@ -497,6 +492,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 @@ -525,7 +530,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 @@ -535,7 +547,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 @@ -629,7 +641,7 @@
<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 @@ -653,7 +665,7 @@
<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
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
15 changes: 15 additions & 0 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -3685,6 +3685,21 @@ public PagedIterable<GHRepositoryRule> listRulesForBranch(String branch) throws
.toIterable(GHRepositoryRule[].class, null);
}

/**
* Check, if vulnerability alerts are enabled for this repository
* (https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#check-if-vulnerability-alerts-are-enabled-for-a-repository).
*
* @return true, if vulnerability alerts are enabled
* @throws IOException
* the io exception
*/
public boolean isVulnerabilityAlertsEnabled() throws IOException {
return root().createRequest()
.method("GET")
.withUrlPath(getApiTailUrl("/vulnerability-alerts"))
.fetchHttpStatusCode() == 204;
}

/**
* A {@link GHRepositoryBuilder} that allows multiple properties to be updated per request.
*
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/kohsuke/github/GHUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ public Optional<String> getLdapDn() throws IOException {
* on error
*/
public Date getSuspendedAt() throws IOException {
super.populate();
return GitHubClient.parseDate(suspendedAt);
}

Expand Down
Loading

0 comments on commit b9cdb7f

Please sign in to comment.