diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index fa07eabc3..8a2b59f8d 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -2,14 +2,18 @@ name: CI
on: [push, pull_request]
+# this is required by spotless for JDK 16+
+env:
+ JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
jobs:
build:
name: build-only (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
+ fail-fast: false
matrix:
- java: [ 13 ]
+ java: [ 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
@@ -24,11 +28,14 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install (skipTests)
+ env:
+ MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
site:
name: site (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
+ fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
@@ -49,9 +56,10 @@ jobs:
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
runs-on: ${{ matrix.os }}-latest
strategy:
+ fail-fast: false
matrix:
os: [ ubuntu, windows ]
- java: [ 8, 11, 13, 15-ea ]
+ java: [ 8, 11, 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
@@ -64,9 +72,21 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
+ # JDK 8
- name: Maven Install without Code Coverage
- if: matrix.os == 'windows'
+ if: matrix.os == 'windows' && matrix.java == '8'
run: mvn -B install --file pom.xml
- name: Maven Install with Code Coverage
- if: matrix.os != 'windows'
+ if: matrix.os != 'windows' && matrix.java == '8'
+ run: mvn -B install -D enable-ci --file pom.xml
+ # JDK 11+
+ - name: Maven Install without Code Coverage
+ if: matrix.os == 'windows' && matrix.java != '8'
+ env:
+ MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
+ run: mvn -B install --file pom.xml
+ - name: Maven Install with Code Coverage
+ if: matrix.os != 'windows' && matrix.java != '8'
+ env:
+ MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install -D enable-ci --file pom.xml
diff --git a/pom.xml b/pom.xml
index e18e28a7f..cef2825ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,6 +45,8 @@
false
0.11.2
+
+
@@ -272,6 +274,7 @@
default-test
src/test/resources/slow-or-flaky-tests.txt
+ ${surefire.argLine}
@@ -284,6 +287,7 @@
2
src/test/resources/slow-or-flaky-tests.txt
+ ${surefire.argLine}
@@ -561,6 +565,16 @@
+
+ jdk11+
+
+ [11,)
+
+
+
+ --add-opens java.base/java.net=ALL-UNNAMED
+
+
ci-non-windows
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 85628d5d3..db66b7f50 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -2,6 +2,7 @@ package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.util.ArrayList;
@@ -22,6 +23,11 @@ import javax.annotation.Nonnull;
*/
public class GHLabel extends GitHubInteractiveObject {
+ private long id;
+ private String nodeId;
+ @JsonProperty("default")
+ private boolean default_;
+
@Nonnull
private String url, name, color;
@@ -42,6 +48,24 @@ public class GHLabel extends GitHubInteractiveObject {
return Objects.requireNonNull(root);
}
+ /**
+ * Gets id.
+ *
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * Gets node id.
+ *
+ * @return the node id.
+ */
+ public String getNodeId() {
+ return nodeId;
+ }
+
/**
* Gets url.
*
@@ -82,6 +106,15 @@ public class GHLabel extends GitHubInteractiveObject {
return description;
}
+ /**
+ * If the label is one of the default labels created by GitHub automatically.
+ *
+ * @return true if the label is a default one
+ */
+ public boolean isDefault() {
+ return default_;
+ }
+
/**
* Sets color.
*
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index a15e751ca..1c0d97bd8 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -965,6 +965,9 @@ public class AppTest extends AbstractGitHubWireMockTest {
GHLabel e = r.getLabel("enhancement");
assertEquals("enhancement", e.getName());
assertNotNull(e.getUrl());
+ assertEquals(177339106, e.getId());
+ assertEquals("MDU6TGFiZWwxNzczMzkxMDY=", e.getNodeId());
+ assertTrue(e.isDefault());
assertTrue(Pattern.matches("[0-9a-fA-F]{6}", e.getColor()));
GHLabel t = null;
@@ -976,12 +979,17 @@ public class AppTest extends AbstractGitHubWireMockTest {
assertThat(t, not(sameInstance(t2)));
assertThat(t, equalTo(t2));
+ assertFalse(t2.isDefault());
+
+ assertEquals(t.getId(), t2.getId());
+ assertEquals(t.getNodeId(), t2.getNodeId());
assertEquals(t.getName(), t2.getName());
assertEquals(t.getColor(), "123456");
assertEquals(t.getColor(), t2.getColor());
assertEquals(t.getDescription(), "");
assertEquals(t.getDescription(), t2.getDescription());
assertEquals(t.getUrl(), t2.getUrl());
+ assertEquals(t.isDefault(), t2.isDefault());
// update works on multiple changes in one call
t3 = t.update().color("000000").description("It is dark!").done();
diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
index 70f339327..87a2c5f10 100644
--- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java
+++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
@@ -9,7 +9,14 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
/**
* @author Kohsuke Kawaguchi
@@ -418,7 +425,11 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
Collection labels = getRepository().getPullRequest(p.getNumber()).getLabels();
assertEquals(1, labels.size());
- assertEquals(label, labels.iterator().next().getName());
+ GHLabel savedLabel = labels.iterator().next();
+ assertEquals(label, savedLabel.getName());
+ assertNotNull(savedLabel.getId());
+ assertNotNull(savedLabel.getNodeId());
+ assertFalse(savedLabel.isDefault());
}
@Test
diff --git a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
index 0fb168eae..98be781fa 100644
--- a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
+++ b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
@@ -1,13 +1,20 @@
package org.kohsuke.github;
+import org.junit.Assume;
import org.junit.Test;
import org.kohsuke.github.authorization.UserAuthorizationProvider;
import java.io.IOException;
import java.lang.reflect.Field;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.lessThan;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.nullValue;
/**
* Unit test for {@link GitHub}.
@@ -56,6 +63,8 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
@Test
public void testGitHubBuilderFromEnvironment() throws IOException {
+ // we disable this test for JDK 16+ as the current hacks in setupEnvironment() don't work with JDK 16+
+ Assume.assumeThat(Double.valueOf(System.getProperty("java.specification.version")), lessThan(16.0));
Map props = new HashMap();
@@ -98,6 +107,9 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
@Test
public void testGitHubBuilderFromCustomEnvironment() throws IOException {
+ // we disable this test for JDK 16+ as the current hacks in setupEnvironment() don't work with JDK 16+
+ Assume.assumeThat(Double.valueOf(System.getProperty("java.specification.version")), lessThan(16.0));
+
Map props = new HashMap();
props.put("customEndpoint", "bogus endpoint url");