-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from suryagaddipati/master
Add code for creating deployments for a repo
- Loading branch information
Showing
4 changed files
with
71 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.kohsuke.github; | ||
|
||
public class GHDeployment { | ||
private GHRepository owner; | ||
private GitHub root; | ||
|
||
GHDeployment wrap(GHRepository owner) { | ||
this.owner = owner; | ||
this.root = owner.root; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
public class GHDeploymentBuilder { | ||
private final GHRepository repo; | ||
private final Requester builder; | ||
|
||
public GHDeploymentBuilder(GHRepository repo) { | ||
this.repo = repo; | ||
this.builder = new Requester(repo.root); | ||
} | ||
|
||
public GHDeploymentBuilder ref(String branch) { | ||
builder.with("ref",branch); | ||
return this; | ||
} | ||
|
||
public GHDeploymentBuilder payload(String payload) { | ||
builder.with("payload",payload); | ||
return this; | ||
} | ||
|
||
public GHDeploymentBuilder description(String description) { | ||
builder.with("description",description); | ||
return this; | ||
} | ||
|
||
public GHDeployment create() throws IOException { | ||
return builder.to(repo.getApiTailUrl("deployments"),GHDeployment.class).wrap(repo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters