Skip to content

Commit 3892e6e

Browse files
authored
Merge branch 'master' into issue_457_create_team_with_repo_access_fix
2 parents 33467de + 6fb3b01 commit 3892e6e

File tree

47 files changed

+2273
-74
lines changed

Some content is hidden

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

47 files changed

+2273
-74
lines changed

.github/release-drafter.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name-template: 'v$NEXT_PATCH_VERSION 🌈'
2+
tag-template: 'v$NEXT_PATCH_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
template: |
17+
## Changes
18+
19+
$CHANGES

.github/workflows/maven-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Maven Download all dependencies
2020
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline
2121
- name: Maven Build
22-
run: mvn -B package --file pom.xml
22+
run: mvn -B install site --file pom.xml

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at bitwiseman@gmail.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

pom.xml

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
<description>GitHub API for Java</description>
1515

1616
<scm>
17-
<connection>scm:git:git@github.com/kohsuke/${project.artifactId}.git</connection>
18-
<developerConnection>scm:git:ssh://git@github.com/kohsuke/${project.artifactId}.git</developerConnection>
17+
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
18+
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
1919
<url>https://${project.artifactId}.kohsuke.org/</url>
2020
<tag>HEAD</tag>
2121
</scm>
2222

2323
<distributionManagement>
2424
<site>
2525
<id>github-pages</id>
26-
<url>gitsite:git@github.com/kohsuke/${project.artifactId}.git</url>
26+
<url>gitsite:git@github.com/github-api/${project.artifactId}.git</url>
2727
</site>
2828
</distributionManagement>
2929

@@ -44,6 +44,18 @@
4444
</properties>
4545

4646
<build>
47+
<extensions>
48+
<extension>
49+
<groupId>org.apache.maven.scm</groupId>
50+
<artifactId>maven-scm-provider-gitexe</artifactId>
51+
<version>1.11.2</version>
52+
</extension>
53+
<extension>
54+
<groupId>org.apache.maven.scm</groupId>
55+
<artifactId>maven-scm-manager-plexus</artifactId>
56+
<version>1.11.2</version>
57+
</extension>
58+
</extensions>
4759
<testResources>
4860
<testResource>
4961
<directory>src/test/resources</directory>
@@ -60,9 +72,45 @@
6072
<artifactId>jacoco-maven-plugin</artifactId>
6173
<version>0.8.5</version>
6274
</plugin>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-javadoc-plugin</artifactId>
78+
<version>3.1.1</version>
79+
<configuration>
80+
<source>8</source>
81+
</configuration>
82+
</plugin>
6383
</plugins>
6484
</pluginManagement>
6585
<plugins>
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-site-plugin</artifactId>
89+
<version>3.8.2</version>
90+
</plugin>
91+
<plugin>
92+
<groupId>org.apache.maven.plugins</groupId>
93+
<artifactId>maven-release-plugin</artifactId>
94+
<version>2.5.3</version>
95+
<configuration>
96+
<autoVersionSubmodules>true</autoVersionSubmodules>
97+
<useReleaseProfile>false</useReleaseProfile>
98+
<releaseProfiles>release</releaseProfiles>
99+
<goals>deploy</goals>
100+
</configuration>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-project-info-reports-plugin</artifactId>
105+
<version>3.0.0</version>
106+
<dependencies>
107+
<dependency>
108+
<groupId>org.apache.bcel</groupId>
109+
<artifactId>bcel</artifactId>
110+
<version>6.4.1</version>
111+
</dependency>
112+
</dependencies>
113+
</plugin>
66114
<plugin>
67115
<artifactId>maven-compiler-plugin</artifactId>
68116
<version>3.8.1</version>
@@ -292,7 +340,7 @@
292340
<id>jacoco</id>
293341
<activation>
294342
<property>
295-
<name>!jacoco.disabled</name>
343+
<name>enable-jacoco</name>
296344
</property>
297345
</activation>
298346
<build>
@@ -385,13 +433,49 @@
385433
</plugins>
386434
</build>
387435
</profile>
436+
<profile>
437+
<id>release</id>
438+
<build>
439+
<plugins>
440+
<plugin>
441+
<groupId>org.apache.maven.plugins</groupId>
442+
<artifactId>maven-gpg-plugin</artifactId>
443+
<version>1.6</version>
444+
<executions>
445+
<execution>
446+
<id>sign-artifacts</id>
447+
<phase>verify</phase>
448+
<goals>
449+
<goal>sign</goal>
450+
</goals>
451+
<configuration>
452+
<gpgArguments>
453+
<arg>--pinentry-mode</arg>
454+
<arg>loopback</arg>
455+
</gpgArguments>
456+
</configuration>
457+
</execution>
458+
</executions>
459+
</plugin>
460+
<plugin>
461+
<groupId>org.apache.maven.plugins</groupId>
462+
<artifactId>maven-source-plugin</artifactId>
463+
<version>3.1.0</version>
464+
</plugin>
465+
</plugins>
466+
</build>
467+
</profile>
388468
</profiles>
389469
<reporting>
390470
<plugins>
391471
<plugin>
392472
<groupId>org.apache.maven.plugins</groupId>
393473
<artifactId>maven-javadoc-plugin</artifactId>
394474
</plugin>
475+
<plugin>
476+
<groupId>org.apache.maven.plugins</groupId>
477+
<artifactId>maven-project-info-reports-plugin</artifactId>
478+
</plugin>
395479
</plugins>
396480
</reporting>
397481

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public abstract class AbuseLimitHandler {
2727
* this exception (or wrap this exception into another exception and throw it).
2828
* @param uc
2929
* Connection that resulted in an error. Useful for accessing other response headers.
30+
* @throws IOException
3031
*/
3132
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
3233

@@ -38,7 +39,7 @@ public abstract class AbuseLimitHandler {
3839
public void onError(IOException e, HttpURLConnection uc) throws IOException {
3940
try {
4041
Thread.sleep(parseWaitTime(uc));
41-
} catch (InterruptedException _) {
42+
} catch (InterruptedException ex) {
4243
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
4344
}
4445
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public void setPermissions(Map<String, String> permissions) {
104104
* You must use a JWT to access this endpoint.
105105
*
106106
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
107+
* @return a list of App installations
107108
*/
108109
@Preview @Deprecated
109110
public PagedIterable<GHAppInstallation> listInstallations() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GHAppCreateTokenBuilder {
3535
*
3636
*/
3737
@Preview @Deprecated
38-
public GHAppCreateTokenBuilder repositoryIds(List<Integer> repositoryIds) {
38+
public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
3939
this.builder.with("repository_ids",repositoryIds);
4040
return this;
4141
}

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,29 @@ public void reopen() throws IOException {
8585
edit("state", "open");
8686
}
8787

88+
/**
89+
* Deletes this milestone.
90+
*/
91+
public void delete() throws IOException {
92+
root.retrieve().method("DELETE").to(getApiRoute());
93+
}
94+
8895
private void edit(String key, Object value) throws IOException {
8996
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
9097
}
9198

99+
public void setTitle(String title) throws IOException {
100+
edit("title", title);
101+
}
102+
103+
public void setDescription(String description) throws IOException {
104+
edit("description", description);
105+
}
106+
107+
public void setDueOn(Date dueOn) throws IOException {
108+
edit("due_on", GitHub.printDate(dueOn));
109+
}
110+
92111
protected String getApiRoute() {
93112
return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/milestones/"+number;
94113
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/**
3434
* A GitHub project.
35-
* @see https://developer.github.com/v3/projects/
35+
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
3636
* @author Martin van Zijl
3737
*/
3838
public class GHProject extends GHObject {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public PagedIterable<GHDeployment> listDeployments(String sha,String ref,String
129129
* Obtains a single {@link GHDeployment} by its ID.
130130
*/
131131
public GHDeployment getDeployment(long id) throws IOException {
132-
return root.retrieve().to("deployments/" + id, GHDeployment.class).wrap(this);
132+
return root.retrieve().to(getApiTailUrl("deployments/" + id), GHDeployment.class).wrap(this);
133133
}
134134

135135
private String join(List<String> params, String joinStr) {
@@ -866,7 +866,7 @@ public GHHook getHook(int id) throws IOException {
866866

867867
/**
868868
* Gets a comparison between 2 points in the repository. This would be similar
869-
* to calling <tt>git log id1...id2</tt> against a local repository.
869+
* to calling <code>git log id1...id2</code> against a local repository.
870870
* @param id1 an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a direct tag name
871871
* @param id2 an identifier for the second point to compare to. Can be the same as the first point.
872872
* @return the comparison output
@@ -928,7 +928,7 @@ public PagedIterable<GHRef> listRefs() throws IOException {
928928

929929
/**
930930
* Retrieves all refs of the given type for the current GitHub repository.
931-
* @param refType the type of reg to search for e.g. <tt>tags</tt> or <tt>commits</tt>
931+
* @param refType the type of reg to search for e.g. <code>tags</code> or <code>commits</code>
932932
* @return an array of all refs matching the request type
933933
* @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested
934934
*/
@@ -939,7 +939,7 @@ public GHRef[] getRefs(String refType) throws IOException {
939939
/**
940940
* Retrieves all refs of the given type for the current GitHub repository.
941941
*
942-
* @param refType the type of reg to search for e.g. <tt>tags</tt> or <tt>commits</tt>
942+
* @param refType the type of reg to search for e.g. <code>tags</code> or <code>commits</code>
943943
* @return paged iterable of all refs of the specified type
944944
* @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested
945945
*/

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class GitHub {
115115
*
116116
* @param apiUrl
117117
* The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or
118-
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <tt>/api/v3</tt> in the URL.
118+
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> in the URL.
119119
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
120120
* Password is also considered deprecated as it is no longer required for api usage.
121121
* @param login
@@ -180,7 +180,7 @@ public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken)
180180
*
181181
* @param apiUrl
182182
* The URL of GitHub (or GitHub Enterprise) API endpoint, such as "https://api.github.com" or
183-
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <tt>/api/v3</tt> in the URL.
183+
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> in the URL.
184184
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
185185
*/
186186
public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, String oauthAccessToken) throws IOException {
@@ -551,7 +551,7 @@ public Map<String, GHOrganization> getUserPublicOrganizations(GHUser user) throw
551551
*
552552
* To retrieve full organization details, you need to call {@link #getOrganization(String)}
553553
*
554-
* @param user the user to retrieve public Organization membership information for
554+
* @param login the user to retrieve public Organization membership information for
555555
*
556556
* @return the public Organization memberships for the user
557557
*/
@@ -956,7 +956,9 @@ public Reader renderMarkdown(String text) throws IOException {
956956
}
957957

958958
/*package*/ static String printDate(Date dt) {
959-
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(dt);
959+
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
960+
df.setTimeZone(TimeZone.getTimeZone("GMT"));
961+
return df.format(dt);
960962
}
961963

962964
/*package*/ static final ObjectMapper MAPPER = new ObjectMapper();

0 commit comments

Comments
 (0)