mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 18:24:12 +00:00
Add repo branches endpoint (#481)
* add repo branches endpoint * add branches func to remotes
This commit is contained in:
@@ -170,6 +170,20 @@ func GetRepoPermissions(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, perm)
|
||||
}
|
||||
|
||||
func GetRepoBranches(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
user := session.User(c)
|
||||
r := remote.FromContext(c)
|
||||
|
||||
branches, err := r.Branches(c, user, repo)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, branches)
|
||||
}
|
||||
|
||||
func DeleteRepo(c *gin.Context) {
|
||||
remove, _ := strconv.ParseBool(c.Query("remove"))
|
||||
r := remote.FromContext(c)
|
||||
|
Reference in New Issue
Block a user