Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f8d14d2

Browse filesBrowse files
Implement the ability to delete content.
1 parent b0c3075 commit f8d14d2
Copy full SHA for f8d14d2

File tree

Expand file treeCollapse file tree

1 file changed

+21
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-0
lines changed

‎src/main/java/org/kohsuke/github/GHContent.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContent.java
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,27 @@ public GHContentUpdateResponse update(String newContent, String commitMessage, S
104104
return response;
105105
}
106106

107+
public GHContentUpdateResponse delete(String message) throws IOException {
108+
return delete(message, null);
109+
}
110+
111+
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
112+
Requester requester = new Requester(owner.root)
113+
.with("path", path)
114+
.with("message", commitMessage)
115+
.with("sha", sha)
116+
.method("DELETE");
117+
118+
if (branch != null) {
119+
requester.with("branch", branch);
120+
}
121+
122+
GHContentUpdateResponse response = requester.to(getApiRoute(), GHContentUpdateResponse.class);
123+
124+
response.getCommit().wrapUp(owner);
125+
return response;
126+
}
127+
107128
private String getApiRoute() {
108129
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/contents/" + path;
109130
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.