Skip to content

Commit

Permalink
rebased and fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Mar 18, 2016
2 parents 6f86b1a + a13c5e7 commit d2e8caa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/jenkinsci/plugins/ghprb/Ghprb.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ public boolean isTriggerPhrase(String comment) {
public boolean ifOnlyTriggerPhrase() {
return trigger.getOnlyTriggerPhrase();
}

public boolean suppressTestingRequest() {
return trigger.getSuppressTestingRequest();
}

public boolean isWhitelisted(GHUser user) {
return trigger.getPermitAll()
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public GhprbPullRequest(GHPullRequest pr,
try {
if (ghprb.isWhitelisted(getPullRequestAuthor())) {
setAccepted(true);
} else {
} else if (!helper.suppressTestingRequest()) {
logger.log(Level.INFO,
"Author of #{0} {1} on {2} not in whitelist!",
new Object[] { id, author.getLogin(), reponame });
Expand Down Expand Up @@ -492,7 +492,7 @@ public boolean isMergeable() {

/**
* Base and Ref are part of the PullRequest object
*
*
* @return
*/
public String getTarget() {
Expand All @@ -505,7 +505,7 @@ public String getTarget() {

/**
* Head and Ref are part of the PullRequest object
*
*
* @return
*/
public String getSource() {
Expand All @@ -518,7 +518,7 @@ public String getSource() {

/**
* Title is part of the PullRequest object
*
*
* @return
*/
public String getTitle() {
Expand All @@ -541,7 +541,7 @@ public URL getUrl() throws IOException {

/**
* The description body is part of the PullRequest object
*
*
* @return
*/
public String getDescription() {
Expand All @@ -558,7 +558,7 @@ public GitUser getCommitAuthor() {

/**
* Author is part of the PullRequest Object
*
*
* @return
* @throws IOException
*/
Expand All @@ -568,7 +568,7 @@ public GHUser getPullRequestAuthor() throws IOException {

/**
* Get the PullRequest object for this PR
*
*
* @param force - forces the code to go get the PullRequest from GitHub now
* @return
* @throws IOException
Expand Down Expand Up @@ -610,7 +610,7 @@ private void setPullRequest(GHPullRequest pr) {

/**
* Email address is collected from GitHub as extra information, so lets cache it.
*
*
* @return
*/
public String getAuthorEmail() {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class GhprbTrigger extends GhprbTriggerBackwardsCompatible {
private final String cron;
private final String buildDescTemplate;
private final Boolean onlyTriggerPhrase;
private final Boolean suppressTestingRequest;
private final Boolean useGitHubHooks;
private final Boolean permitAll;
private String whitelist;
Expand Down Expand Up @@ -125,6 +126,7 @@ public GhprbTrigger(String adminlist,
String triggerPhrase,
Boolean onlyTriggerPhrase,
Boolean useGitHubHooks,
Boolean suppressTestingRequest,
Boolean permitAll,
Boolean autoCloseFailedPullRequests,
Boolean displayBuildErrorsOnDownstreamBuilds,
Expand All @@ -145,6 +147,7 @@ public GhprbTrigger(String adminlist,
this.cron = cron;
this.triggerPhrase = triggerPhrase;
this.onlyTriggerPhrase = onlyTriggerPhrase;
this.suppressTestingRequest = suppressTestingRequest;
this.useGitHubHooks = useGitHubHooks;
this.permitAll = permitAll;
this.autoCloseFailedPullRequests = autoCloseFailedPullRequests;
Expand Down Expand Up @@ -494,6 +497,10 @@ public String getTriggerPhrase() {
public Boolean getOnlyTriggerPhrase() {
return onlyTriggerPhrase != null && onlyTriggerPhrase;
}

public Boolean getSuppressTestingRequest() {
return suppressTestingRequest != null && suppressTestingRequest;
}

public Boolean getUseGitHubHooks() {
return useGitHubHooks != null && useGitHubHooks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ f.advanced() {
f.entry(field: "onlyTriggerPhrase", title: "Only use trigger phrase for build triggering") {
f.checkbox()
}
f.entry(field: "suppressTestingRequest", title: "Don't send request for approval message for non-whitelisted builders") {
f.checkbox()
}
f.entry(field: "autoCloseFailedPullRequests", title: _("Close failed pull request automatically?")) {
f.checkbox(default: descriptor.autoCloseFailedPullRequests)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<f:entry title="Only use trigger phrase for build triggering" field="onlyTriggerPhrase">
<f:checkbox />
</f:entry>
<f:entry title="Don't send request for approval message for non-whitelisted builders" field="suppressTestingRequest">
<f:checkbox />
</f:entry>
<f:entry title="${%Close failed pull request automatically?}" field="autoCloseFailedPullRequests">
<f:checkbox default="${descriptor.autoCloseFailedPullRequests}"/>
</f:entry>
Expand Down

0 comments on commit d2e8caa

Please sign in to comment.