Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for field author.login and committer.login to /commits call #1837

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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.322-SNAPSHOT</version>
<version>1.322-ecwid-8</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/kohsuke/github/GHBranch.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public GHBranchProtection getProtection() throws IOException {
.fetch(GHBranchProtection.class);
}

public PagedIterable<GHRule> getRules() throws IOException {
return root().createRequest()
.withPreview(Previews.LUKE_CAGE)
.withUrlPath(owner.getApiTailUrl("rules/branches/" + name))
.toIterable(GHRule[].class, GHRule::wrap);
}

/**
* Gets sha 1.
*
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/org/kohsuke/github/GHCommit.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,40 @@ public GHRepository getOwner() {
return owner;
}

/**
* Gets commit verification.
* @return
*/
public GHVerification getVerification() {
return commit.getVerification();
}

/**
* Gets commit author.
* @return
*/
public GitUser getCommitAuthor() {
return commit.getAuthor();
}

/**
* Gets commit committer.
* @return
*/
public GitUser getCommitCommitter() {
return commit.getCommitter();
}

/**
* Gets message.
*
* @return the commit message
* @throws IOException
* the io exception
*/
public String getMessage() throws IOException {
return getCommitShortInfo().getMessage();
}
/**
* Gets lines changed.
*
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
justification = "JSON API")
public class GHPullRequestCommitDetail {
private GHPullRequest owner;
private GHCommitDetailAuthor author;
private GHCommitDetailAuthor committer;

/**
* Wrap up.
Expand All @@ -52,6 +54,20 @@ void wrapUp(GHPullRequest owner) {
this.owner = owner;
}

/**
* Type for the GitHub user
*/
public static class GHCommitDetailAuthor {
String login;

/**
* GitHub user login
*/
public String getLogin() {
return login;
}
}

/**
* The type Authorship.
*
Expand Down Expand Up @@ -285,4 +301,20 @@ public CommitPointer[] getParents() {
System.arraycopy(parents, 0, newValue, 0, parents.length);
return newValue;
}

/**
* Gets the GitHub user - author of the commit.
*
*/
public GHCommitDetailAuthor getAuthor() {
return author;
}

/**
* Gets the GitHub user - committer of the commit.
*
*/
public GHCommitDetailAuthor getCommitter() {
return committer;
}
}
142 changes: 142 additions & 0 deletions src/main/java/org/kohsuke/github/GHRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package org.kohsuke.github;

import java.util.Collection;

public class GHRule {
private RuleType type;
private Parameters parameters;

public RuleType getType() {
return type;
}

public void setType(RuleType type) {
this.type = type;
}

public Parameters getParameters() {
return parameters;
}

public void setParameters(Parameters parameters) {
this.parameters = parameters;
}


public GHRule wrap() {
return this;
}

public enum RuleType {
commit_author_email_pattern,
creation,
deletion,
merge_queue,
non_fast_forward,
pull_request,
require_code_scanning,
require_deployments,
require_linear_history,
required_signatures,
required_status_checks,
update,
}

public static class Parameters {
private Collection<RequiredCheck> required_status_checks;
private MergeMethod merge_method;
private Integer max_entries_to_build;
private Integer min_entries_to_merge;
private Integer max_entries_to_merge;
private Integer min_entries_to_merge_wait_minutes;
private Integer check_response_timeout_minutes;
private GroupingStrategy grouping_strategy;

public Collection<RequiredCheck> getRequiredStatusChecks() {
return required_status_checks;
}

public void setRequiredStatusChecks(Collection<RequiredCheck> required_status_checks) {
this.required_status_checks = required_status_checks;
}

public MergeMethod getMergeMethod() {
return merge_method;
}

public void setMergeMethod(MergeMethod merge_method) {
this.merge_method = merge_method;
}

public Integer getMaxEntriesToBuild() {
return max_entries_to_build;
}

public void setMaxEntriesToBuild(Integer maxEntriesToBuild) {
this.max_entries_to_build = maxEntriesToBuild;
}

public Integer getMinEntriesToMerge() {
return min_entries_to_merge;
}

public void setMinEntriesToMerge(Integer minEntriesToMerge) {
this.min_entries_to_merge = minEntriesToMerge;
}

public Integer getMaxEntriesToMerge() {
return max_entries_to_merge;
}

public void setMaxEntriesToMerge(Integer maxEntriesToMerge) {
this.max_entries_to_merge = maxEntriesToMerge;
}

public Integer getMinEntriesToMergeWaitMinutes() {
return min_entries_to_merge_wait_minutes;
}

public void setMinEntriesToMergeWaitMinutes(Integer minEntriesToMergeWaitMinutes) {
this.min_entries_to_merge_wait_minutes = minEntriesToMergeWaitMinutes;
}

public Integer getCheckResponseTimeoutMinutes() {
return check_response_timeout_minutes;
}

public void setCheckResponseTimeoutMinutes(Integer checkResponseTimeoutMinutes) {
this.check_response_timeout_minutes = checkResponseTimeoutMinutes;
}

public GroupingStrategy getGroupingStrategy() {
return grouping_strategy;
}

public void setGroupingStrategy(GroupingStrategy groupingStrategy) {
this.grouping_strategy = groupingStrategy;
}
}

public static class RequiredCheck {
private String context;

public String getContext() {
return context;
}

public void setContext(String context) {
this.context = context;
}
}

public enum MergeMethod {
MERGE,
SQUASH,
REBASE
}

public enum GroupingStrategy {
ALLGREEN,
HEADGREEN
}
}