Skip to content

Commit 72b2049

Browse files
committed
Merge tag 'github-api-2.0-rc.5' into release/v2.x
github-api-2.0-rc.5
2 parents 2b97817 + 9caca87 commit 72b2049

File tree

22 files changed

+863
-33
lines changed

22 files changed

+863
-33
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242

4343
steps:
4444
- name: Set up JDK
45-
uses: actions/setup-java@v4
45+
uses: actions/setup-java@v5
4646
with:
4747
distribution: 'temurin'
4848
java-version: 17
4949

5050
- name: Checkout repository
51-
uses: actions/checkout@v4
51+
uses: actions/checkout@v5
5252

5353
# Initializes the CodeQL tools for scanning.
5454
- name: Initialize CodeQL

.github/workflows/create_release_tag_and_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
create_release_tag:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414
with:
1515
fetch-depth: 0
1616

1717
- name: Set up Maven Central Repository
18-
uses: actions/setup-java@v4
18+
uses: actions/setup-java@v5
1919
with:
2020
java-version: '17'
2121
distribution: 'temurin'

.github/workflows/maven-build.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
strategy:
2626
fail-fast: true
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929
- name: Set up JDK
30-
uses: actions/setup-java@v4
30+
uses: actions/setup-java@v5
3131
with:
3232
java-version: 17
3333
distribution: 'temurin'
@@ -47,9 +47,9 @@ jobs:
4747
strategy:
4848
fail-fast: false
4949
steps:
50-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
5151
- name: Set up JDK
52-
uses: actions/setup-java@v4
52+
uses: actions/setup-java@v5
5353
with:
5454
java-version: 17
5555
distribution: 'temurin'
@@ -68,9 +68,9 @@ jobs:
6868
strategy:
6969
fail-fast: true
7070
steps:
71-
- uses: actions/checkout@v4
71+
- uses: actions/checkout@v5
7272
- name: Set up JDK
73-
uses: actions/setup-java@v4
73+
uses: actions/setup-java@v5
7474
with:
7575
java-version: 17
7676
distribution: 'temurin'
@@ -90,9 +90,9 @@ jobs:
9090
os: [ ubuntu, windows ]
9191
java: [ 17, 21 ]
9292
steps:
93-
- uses: actions/checkout@v4
93+
- uses: actions/checkout@v5
9494
- name: Set up JDK
95-
uses: actions/setup-java@v4
95+
uses: actions/setup-java@v5
9696
with:
9797
java-version: ${{ matrix.java }}
9898
distribution: 'temurin'
@@ -120,13 +120,13 @@ jobs:
120120
needs: test
121121
runs-on: ubuntu-latest
122122
steps:
123-
- uses: actions/checkout@v4
124-
- uses: actions/download-artifact@v4
123+
- uses: actions/checkout@v5
124+
- uses: actions/download-artifact@v5
125125
with:
126126
name: maven-test-target-directory
127127
path: target
128128
- name: Codecov Report
129-
uses: codecov/codecov-action@v5.4.3
129+
uses: codecov/codecov-action@v5.5.0
130130
with:
131131
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings
132132
token: ${{ secrets.CODECOV_TOKEN }}
@@ -138,13 +138,13 @@ jobs:
138138
needs: build
139139
runs-on: ubuntu-latest
140140
steps:
141-
- uses: actions/checkout@v4
142-
- uses: actions/download-artifact@v4
141+
- uses: actions/checkout@v5
142+
- uses: actions/download-artifact@v5
143143
with:
144144
name: maven-target-directory
145145
path: target
146146
- name: Set up JDK
147-
uses: actions/setup-java@v4
147+
uses: actions/setup-java@v5
148148
with:
149149
java-version: 11
150150
distribution: 'temurin'

.github/workflows/publish_release_branch.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- name: Set up Maven Central Repository
17-
uses: actions/setup-java@v4
17+
uses: actions/setup-java@v5
1818
with:
1919
java-version: '17'
2020
distribution: 'temurin'
@@ -35,9 +35,9 @@ jobs:
3535
runs-on: ubuntu-latest
3636
needs: build
3737
steps:
38-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v5
3939
- name: Set up Maven Central Repository
40-
uses: actions/setup-java@v4
40+
uses: actions/setup-java@v5
4141
with:
4242
java-version: '17'
4343
distribution: 'temurin'
@@ -69,7 +69,7 @@ jobs:
6969
needs: build
7070
if: ${{ github.ref == 'refs/heads/release/v2.x' }}
7171
steps:
72-
- uses: actions/checkout@v4
72+
- uses: actions/checkout@v5
7373
with:
7474
fetch-depth: 0
7575

@@ -78,7 +78,7 @@ jobs:
7878
run: |
7979
echo "version=$(mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
8080
81-
- uses: actions/download-artifact@v4
81+
- uses: actions/download-artifact@v5
8282
with:
8383
name: maven-release-target-directory
8484
path: target

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.kohsuke</groupId>
55
<artifactId>${github-api.artifactId}</artifactId>
6-
<version>2.0-rc.4</version>
6+
<version>2.0-rc.5</version>
77
<name>GitHub API for Java</name>
88
<description>GitHub API for Java</description>
99
<url>https://hub4j.github.io/github-api/</url>
@@ -75,7 +75,7 @@
7575
<!-- This project was registered before 2021, so it uses the old server. -->
7676
<nexus.serverUrl>https://ossrh-staging-api.central.sonatype.com</nexus.serverUrl>
7777
<okhttp3.version>4.12.0</okhttp3.version>
78-
<okio.version>3.10.2</okio.version>
78+
<okio.version>3.16.0</okio.version>
7979
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8080
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
8181
<spotbugs-maven-plugin.version>4.9.3.0</spotbugs-maven-plugin.version>
@@ -89,14 +89,14 @@
8989
<dependency>
9090
<groupId>com.fasterxml.jackson</groupId>
9191
<artifactId>jackson-bom</artifactId>
92-
<version>2.19.1</version>
92+
<version>2.20.0</version>
9393
<type>pom</type>
9494
<scope>import</scope>
9595
</dependency>
9696
<dependency>
9797
<groupId>org.junit</groupId>
9898
<artifactId>junit-bom</artifactId>
99-
<version>5.12.1</version>
99+
<version>5.13.4</version>
100100
<type>pom</type>
101101
<scope>import</scope>
102102
</dependency>
@@ -223,7 +223,7 @@
223223
<dependency>
224224
<groupId>com.tngtech.archunit</groupId>
225225
<artifactId>archunit</artifactId>
226-
<version>1.4.0</version>
226+
<version>1.4.1</version>
227227
<scope>test</scope>
228228
</dependency>
229229
<dependency>
@@ -362,7 +362,7 @@
362362
<plugin>
363363
<groupId>org.jacoco</groupId>
364364
<artifactId>jacoco-maven-plugin</artifactId>
365-
<version>0.8.12</version>
365+
<version>0.8.13</version>
366366
<configuration>
367367
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
368368
<excludes>
@@ -473,7 +473,7 @@
473473
<plugin>
474474
<groupId>com.diffplug.spotless</groupId>
475475
<artifactId>spotless-maven-plugin</artifactId>
476-
<version>2.44.5</version>
476+
<version>2.46.1</version>
477477
<configuration>
478478
<java>
479479
<includes>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ public GHCreateRepositoryBuilder gitignoreTemplate(String language) throws IOExc
9898
return with("gitignore_template", language);
9999
}
100100

101+
/**
102+
* Include all branches when creating from a template repository
103+
*
104+
* @param includeAllBranches
105+
* whether or not to include all branches from the template repository
106+
* @return a builder to continue with building
107+
* @throws IOException
108+
* In case of any networking error or error from the server.
109+
*/
110+
public GHCreateRepositoryBuilder includeAllBranches(boolean includeAllBranches) throws IOException {
111+
return with("include_all_branches", includeAllBranches);
112+
}
113+
101114
/**
102115
* Desired license template to apply.
103116
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,9 @@ public GHIssueEvent getIssueEvent(long id) throws IOException {
16031603
* @return the issues
16041604
* @throws IOException
16051605
* the io exception
1606+
* @deprecated Use {@link #queryIssues()} instead.
16061607
*/
1608+
@Deprecated
16071609
public List<GHIssue> getIssues(GHIssueState state) throws IOException {
16081610
return queryIssues().state(state).list().toList();
16091611
}
@@ -1618,7 +1620,9 @@ public List<GHIssue> getIssues(GHIssueState state) throws IOException {
16181620
* @return the issues
16191621
* @throws IOException
16201622
* the io exception
1623+
* @deprecated Use {@link #queryIssues()} instead.
16211624
*/
1625+
@Deprecated
16221626
public List<GHIssue> getIssues(GHIssueState state, GHMilestone milestone) throws IOException {
16231627
return queryIssues().milestone(milestone == null ? "none" : "" + milestone.getNumber())
16241628
.state(state)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static class RetryRequestException extends IOException {
121121
MAPPER.setVisibility(new VisibilityChecker.Std(NONE, NONE, NONE, NONE, ANY));
122122
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
123123
MAPPER.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true);
124-
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
124+
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
125125
}
126126

127127
@Nonnull

src/site/site.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<project name="GitHub API for Java">
33
<bannerLeft>
44
<name>GitHub API for Java</name>
5-
<href>https://github-api.kohsuke.org/</href>
5+
<href>https://hub4j.github.io/github-api/</href>
66
</bannerLeft>
77
<skin>
88
<groupId>org.kohsuke</groupId>

src/test/java/org/kohsuke/github/GHOrganizationTest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,37 @@ public void testCreateRepositoryWithTemplateAndGHRepository() throws IOException
264264

265265
}
266266

267+
/**
268+
* Test create a repository from a template with all branches included
269+
*
270+
* @throws IOException
271+
* Signals that an I/O exception has occurred.
272+
* @throws InterruptedException
273+
* Signals that Thread.sleep() was interrupted
274+
*/
275+
276+
@Test
277+
public void testCreateRepositoryWithTemplateAndIncludeAllBranches() throws IOException, InterruptedException {
278+
cleanupRepository(GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST);
279+
280+
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
281+
GHRepository templateRepository = org.getRepository(GITHUB_API_TEMPLATE_TEST);
282+
283+
GHRepository repository = gitHub.createRepository(GITHUB_API_TEST)
284+
.fromTemplateRepository(templateRepository)
285+
.includeAllBranches(true)
286+
.owner(GITHUB_API_TEST_ORG)
287+
.create();
288+
289+
assertThat(repository, notNullValue());
290+
291+
// give it a moment for branches to be created
292+
Thread.sleep(1500);
293+
294+
assertThat(repository.getBranches().keySet(), equalTo(templateRepository.getBranches().keySet()));
295+
296+
}
297+
267298
/**
268299
* Test create team.
269300
*

0 commit comments

Comments
 (0)