enable deletion of repos as well
This commit is contained in:
parent
3b0618d639
commit
3e31ccce5c
@ -48,9 +48,7 @@ def gitea_handle_repo_action():
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
abort(400) # the data isn't formatted correctly
|
abort(400) # the data isn't formatted correctly
|
||||||
|
|
||||||
if not repo_action == "created":
|
if repo_action == "created":
|
||||||
return ''
|
|
||||||
|
|
||||||
new_repo = github.create_repo(
|
new_repo = github.create_repo(
|
||||||
repo_name, repo_description
|
repo_name, repo_description
|
||||||
)
|
)
|
||||||
@ -83,6 +81,9 @@ def gitea_handle_repo_action():
|
|||||||
)
|
)
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
elif repo_action == "deleted":
|
||||||
|
github.delete_repo(repo_owner, repo_name)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/bridge/endpoints/gitea/issue", methods=["POST"])
|
@app.route("/bridge/endpoints/gitea/issue", methods=["POST"])
|
||||||
def gitea_handle_issue_action():
|
def gitea_handle_issue_action():
|
||||||
|
@ -43,6 +43,9 @@ class WebgitClient:
|
|||||||
def patch(self, *args, **kwargs):
|
def patch(self, *args, **kwargs):
|
||||||
return self._request_wrapper("PATCH", *args, **kwargs)
|
return self._request_wrapper("PATCH", *args, **kwargs)
|
||||||
|
|
||||||
|
def delete(self, *args, **kwargs):
|
||||||
|
return self._request_wrapper("DELETE", *args, **kwargs)
|
||||||
|
|
||||||
def create_repo(self, name, description):
|
def create_repo(self, name, description):
|
||||||
return self.post(
|
return self.post(
|
||||||
self.api_prefix + "/user/repos",
|
self.api_prefix + "/user/repos",
|
||||||
@ -104,6 +107,11 @@ class WebgitClient:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def delete_repo(self, owner, repo_name):
|
||||||
|
return self.delete(
|
||||||
|
self.api_prefix + "/repos/{}/{}".format(owner, repo_name)
|
||||||
|
)
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Github(WebgitClient):
|
class Github(WebgitClient):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user