Skip to content

Commit ba74b91

Browse files
authored
Merge pull request #3 from cortexapps/merge
Merge hub4j master
2 parents 82a8451 + a6b75f1 commit ba74b91

File tree

375 files changed

+19921
-3918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

375 files changed

+19921
-3918
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@ on:
2020
schedule:
2121
- cron: '20 0 * * 6'
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
analyze:
28+
permissions:
29+
actions: read # for github/codeql-action/init to get workflow details
30+
contents: read # for actions/checkout to fetch code
31+
security-events: write # for github/codeql-action/autobuild to send a status report
2532
name: Analyze
2633
runs-on: ubuntu-latest
2734

@@ -39,7 +46,7 @@ jobs:
3946

4047
# Initializes the CodeQL tools for scanning.
4148
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
49+
uses: github/codeql-action/init@v2
4350
with:
4451
languages: ${{ matrix.language }}
4552
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,7 +57,7 @@ jobs:
5057
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5158
# If this step fails, then you should remove it and run the build manually (see below)
5259
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
60+
uses: github/codeql-action/autobuild@v2
5461

5562
# ℹ️ Command-line programs to run using the OS shell.
5663
# 📚 https://git.io/JvXDl
@@ -64,4 +71,4 @@ jobs:
6471
# make release
6572

6673
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
74+
uses: github/codeql-action/analyze@v2

.github/workflows/maven-build.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
env:
1515
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"
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
build:
1922
name: build-only (Java ${{ matrix.java }})
@@ -25,7 +28,7 @@ jobs:
2528
steps:
2629
- uses: actions/checkout@v3
2730
- name: Set up JDK
28-
uses: actions/setup-java@v2
31+
uses: actions/setup-java@v3
2932
with:
3033
java-version: ${{ matrix.java }}
3134
distribution: 'zulu'
@@ -44,7 +47,7 @@ jobs:
4447
steps:
4548
- uses: actions/checkout@v3
4649
- name: Set up JDK
47-
uses: actions/setup-java@v2
50+
uses: actions/setup-java@v3
4851
with:
4952
java-version: ${{ matrix.java }}
5053
distribution: 'adopt'
@@ -62,7 +65,7 @@ jobs:
6265
steps:
6366
- uses: actions/checkout@v3
6467
- name: Set up JDK
65-
uses: actions/setup-java@v2
68+
uses: actions/setup-java@v3
6669
with:
6770
java-version: ${{ matrix.java }}
6871
distribution: 'zulu'
@@ -71,19 +74,19 @@ jobs:
7174
- name: Maven Install with Code Coverage
7275
run: mvn -B clean install -D enable-ci -Djapicmp.skip --file pom.xml
7376
- name: Codecov Report
74-
uses: codecov/codecov-action@v2.1.0
77+
uses: codecov/codecov-action@v3.1.0
7578
test:
7679
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
7780
runs-on: ${{ matrix.os }}-latest
7881
strategy:
7982
fail-fast: false
8083
matrix:
8184
os: [ ubuntu, windows ]
82-
java: [ 11.0.3, 11, 17 ]
85+
java: [ 11, 17 ]
8386
steps:
8487
- uses: actions/checkout@v3
8588
- name: Set up JDK
86-
uses: actions/setup-java@v2
89+
uses: actions/setup-java@v3
8790
with:
8891
java-version: ${{ matrix.java }}
8992
distribution: 'zulu'
@@ -98,19 +101,4 @@ jobs:
98101
if: matrix.os != 'windows'
99102
env:
100103
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
101-
run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"
102-
deploy:
103-
name: Deploy
104-
runs-on: ubuntu-latest
105-
needs: [build, test-8, test]
106-
steps:
107-
- uses: actions/checkout@v2
108-
- uses: actions/setup-java@v2
109-
with:
110-
java-version: 8
111-
distribution: 'zulu'
112-
cache: 'maven'
113-
- name: Deploy
114-
run: mvn --batch-mode deploy
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"

.github/workflows/release-drafter.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
branches:
77
- main
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
update_release_draft:
14+
permissions:
15+
contents: write # for release-drafter/release-drafter to create a github release
16+
pull-requests: write # for release-drafter/release-drafter to add label to PR
1117
runs-on: ubuntu-latest
1218
steps:
1319
- name: Release Drafter

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Contributing
22

3+
## Make sure it's spotless
4+
5+
Run `mvn spotless:apply` to fix any formatting, etc issues.
6+
7+
## Make sure you pass CI
8+
9+
If the following does not succeed, you will not pass the pull request checks.
10+
11+
`mvn -D enable-ci clean install site`
12+
313
## Using WireMock and Snapshots
414

515
This project has started converting to using WireMock to stub out http responses instead of use live data.

pom.xml

Lines changed: 23 additions & 42 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>cortexapps-github-api</artifactId>
5-
<version>1.305-SNAPSHOT</version>
5+
<version>1.306-SNAPSHOT</version>
66
<name>GitHub API for Java</name>
77
<url>https://github-api.kohsuke.org/</url>
88
<description>GitHub API for Java</description>
@@ -33,8 +33,8 @@
3333

3434
<properties>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36-
<spotbugs-maven-plugin.version>4.5.3.0</spotbugs-maven-plugin.version>
37-
<spotbugs.version>4.5.3</spotbugs.version>
36+
<spotbugs-maven-plugin.version>4.7.1.1</spotbugs-maven-plugin.version>
37+
<spotbugs.version>4.7.1</spotbugs.version>
3838
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
3939
<hamcrest.version>2.2</hamcrest.version>
4040
<okhttp3.version>4.9.2</okhttp3.version>
@@ -44,7 +44,7 @@
4444
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
4545
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
4646
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
47-
<jjwt.suite.version>0.11.2</jjwt.suite.version>
47+
<jjwt.suite.version>0.11.5</jjwt.suite.version>
4848

4949
<jacoco.surefire.argLine />
5050
<surefire.argLine />
@@ -55,12 +55,12 @@
5555
<extension>
5656
<groupId>org.apache.maven.scm</groupId>
5757
<artifactId>maven-scm-provider-gitexe</artifactId>
58-
<version>1.12.2</version>
58+
<version>1.13.0</version>
5959
</extension>
6060
<extension>
6161
<groupId>org.apache.maven.scm</groupId>
6262
<artifactId>maven-scm-manager-plexus</artifactId>
63-
<version>1.12.2</version>
63+
<version>1.13.0</version>
6464
</extension>
6565
<!-- Doing site publishing manually for now -->
6666
<!--
@@ -87,6 +87,7 @@
8787
<configuration>
8888
<!-- SUREFIRE-1226 workaround -->
8989
<trimStackTrace>false</trimStackTrace>
90+
<useSystemClassLoader>false</useSystemClassLoader>
9091
</configuration>
9192
</plugin>
9293
<plugin>
@@ -102,7 +103,7 @@
102103
<plugin>
103104
<groupId>org.jacoco</groupId>
104105
<artifactId>jacoco-maven-plugin</artifactId>
105-
<version>0.8.7</version>
106+
<version>0.8.8</version>
106107
<configuration>
107108
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
108109
<excludes>
@@ -213,7 +214,7 @@
213214
<plugin>
214215
<groupId>org.apache.maven.plugins</groupId>
215216
<artifactId>maven-javadoc-plugin</artifactId>
216-
<version>3.3.2</version>
217+
<version>3.4.0</version>
217218
<configuration>
218219
<source>8</source>
219220
<failOnWarnings>true</failOnWarnings>
@@ -223,7 +224,7 @@
223224
<plugin>
224225
<groupId>org.sonatype.plugins</groupId>
225226
<artifactId>nexus-staging-maven-plugin</artifactId>
226-
<version>1.6.12</version>
227+
<version>1.6.13</version>
227228
<extensions>true</extensions>
228229
<configuration>
229230
<serverId>sonatype-nexus-staging</serverId>
@@ -258,7 +259,7 @@
258259
<plugin>
259260
<groupId>org.apache.maven.plugins</groupId>
260261
<artifactId>maven-site-plugin</artifactId>
261-
<version>3.11.0</version>
262+
<version>3.12.1</version>
262263
</plugin>
263264
<plugin>
264265
<groupId>org.apache.maven.plugins</groupId>
@@ -278,7 +279,7 @@
278279
<plugin>
279280
<groupId>org.apache.maven.plugins</groupId>
280281
<artifactId>maven-project-info-reports-plugin</artifactId>
281-
<version>3.2.2</version>
282+
<version>3.4.0</version>
282283
<dependencies>
283284
<dependency>
284285
<groupId>org.apache.bcel</groupId>
@@ -333,7 +334,7 @@
333334
<plugin>
334335
<groupId>com.diffplug.spotless</groupId>
335336
<artifactId>spotless-maven-plugin</artifactId>
336-
<version>2.21.0</version>
337+
<version>2.24.0</version>
337338
<executions>
338339
<execution>
339340
<id>spotless-check</id>
@@ -393,26 +394,6 @@
393394
</dependency>
394395
</dependencies>
395396
</plugin>
396-
<plugin>
397-
<groupId>com.github.siom79.japicmp</groupId>
398-
<artifactId>japicmp-maven-plugin</artifactId>
399-
<version>0.15.7</version>
400-
<configuration>
401-
<parameter>
402-
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
403-
<onlyModified>true</onlyModified>
404-
<includeSynthetic>true</includeSynthetic>
405-
</parameter>
406-
</configuration>
407-
<executions>
408-
<execution>
409-
<phase>verify</phase>
410-
<goals>
411-
<goal>cmp</goal>
412-
</goals>
413-
</execution>
414-
</executions>
415-
</plugin>
416397
</plugins>
417398
</build>
418399

@@ -456,13 +437,13 @@
456437
<dependency>
457438
<groupId>org.awaitility</groupId>
458439
<artifactId>awaitility</artifactId>
459-
<version>4.1.1</version>
440+
<version>4.2.0</version>
460441
<scope>test</scope>
461442
</dependency>
462443
<dependency>
463444
<groupId>com.fasterxml.jackson.core</groupId>
464445
<artifactId>jackson-databind</artifactId>
465-
<version>2.13.1</version>
446+
<version>2.13.3</version>
466447
</dependency>
467448
<dependency>
468449
<groupId>commons-io</groupId>
@@ -505,7 +486,7 @@
505486
<dependency>
506487
<groupId>org.eclipse.jgit</groupId>
507488
<artifactId>org.eclipse.jgit</artifactId>
508-
<version>6.0.0.202111291000-r</version>
489+
<version>6.1.0.202203080745-r</version>
509490
<scope>test</scope>
510491
</dependency>
511492
<dependency>
@@ -561,7 +542,7 @@
561542
<dependency>
562543
<groupId>org.mockito</groupId>
563544
<artifactId>mockito-core</artifactId>
564-
<version>4.3.1</version>
545+
<version>4.6.1</version>
565546
<scope>test</scope>
566547
</dependency>
567548
<dependency>
@@ -579,7 +560,7 @@
579560
<dependency>
580561
<groupId>com.google.code.gson</groupId>
581562
<artifactId>gson</artifactId>
582-
<version>2.9.0</version>
563+
<version>2.9.1</version>
583564
<scope>test</scope>
584565
</dependency>
585566
<dependency>
@@ -622,7 +603,7 @@
622603
<goal>test</goal>
623604
</goals>
624605
<configuration>
625-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
606+
<classesDirectory>${project.basedir}/target/cortexapps-github-api-${project.version}.jar</classesDirectory>
626607
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
627608
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttp</argLine>
628609
</configuration>
@@ -634,7 +615,7 @@
634615
<goal>test</goal>
635616
</goals>
636617
<configuration>
637-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
618+
<classesDirectory>${project.basedir}/target/cortexapps-github-api-${project.version}.jar</classesDirectory>
638619
<rerunFailingTestsCount>2</rerunFailingTestsCount>
639620
<!-- There are some tests that take longer or are a little
640621
flaky. Run them here. -->
@@ -692,7 +673,7 @@
692673
<plugin>
693674
<groupId>org.apache.maven.plugins</groupId>
694675
<artifactId>maven-enforcer-plugin</artifactId>
695-
<version>3.0.0</version>
676+
<version>3.1.0</version>
696677
<executions>
697678
<execution>
698679
<id>enforce-jacoco-exist</id>
@@ -844,7 +825,7 @@
844825
<goal>test</goal>
845826
</goals>
846827
<configuration>
847-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
828+
<classesDirectory>${project.basedir}/target/cortexapps-github-api-${project.version}.jar</classesDirectory>
848829
<useSystemClassLoader>false</useSystemClassLoader>
849830
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
850831
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient</argLine>
@@ -857,7 +838,7 @@
857838
<goal>test</goal>
858839
</goals>
859840
<configuration>
860-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
841+
<classesDirectory>${project.basedir}/target/cortexapps-github-api-${project.version}.jar</classesDirectory>
861842
<useSystemClassLoader>false</useSystemClassLoader>
862843
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
863844
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection</argLine>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
4646
return this;
4747
}
4848

49+
/**
50+
* By default the installation token has access to all repositories that the installation can access. To restrict
51+
* the access to specific repositories, you can provide repository names when creating the token.
52+
*
53+
* @param repositories
54+
* Array containing the repository names
55+
* @return a GHAppCreateTokenBuilder
56+
*/
57+
@BetaApi
58+
public GHAppCreateTokenBuilder repositories(List<String> repositories) {
59+
this.builder.with("repositories", repositories);
60+
return this;
61+
}
62+
4963
/**
5064
* Set the permissions granted to the access token. The permissions object includes the permission names and their
5165
* access type.

0 commit comments

Comments
 (0)