Feature: Support workflow event dispatch via API (#32059)
ref: https://github.com/go-gitea/gitea/issues/31765 --------- Signed-off-by: Bence Santha <git@santha.eu> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
parent
06088ec672
commit
523751dc82
10 changed files with 1685 additions and 137 deletions
|
@ -915,6 +915,21 @@ func Routes() *web.Router {
|
|||
})
|
||||
}
|
||||
|
||||
addActionsWorkflowRoutes := func(
|
||||
m *web.Router,
|
||||
actw actions.WorkflowAPI,
|
||||
) {
|
||||
m.Group("/actions", func() {
|
||||
m.Group("/workflows", func() {
|
||||
m.Get("", reqToken(), actw.ListRepositoryWorkflows)
|
||||
m.Get("/{workflow_id}", reqToken(), actw.GetWorkflow)
|
||||
m.Put("/{workflow_id}/disable", reqToken(), reqRepoWriter(unit.TypeActions), actw.DisableWorkflow)
|
||||
m.Post("/{workflow_id}/dispatches", reqToken(), reqRepoWriter(unit.TypeActions), bind(api.CreateActionWorkflowDispatch{}), actw.DispatchWorkflow)
|
||||
m.Put("/{workflow_id}/enable", reqToken(), reqRepoWriter(unit.TypeActions), actw.EnableWorkflow)
|
||||
}, context.ReferencesGitRepo(), reqRepoReader(unit.TypeActions))
|
||||
})
|
||||
}
|
||||
|
||||
m.Group("", func() {
|
||||
// Miscellaneous (no scope required)
|
||||
if setting.API.EnableSwagger {
|
||||
|
@ -1160,6 +1175,10 @@ func Routes() *web.Router {
|
|||
reqOwner(),
|
||||
repo.NewAction(),
|
||||
)
|
||||
addActionsWorkflowRoutes(
|
||||
m,
|
||||
repo.NewActionWorkflow(),
|
||||
)
|
||||
m.Group("/hooks/git", func() {
|
||||
m.Combo("").Get(repo.ListGitHooks)
|
||||
m.Group("/{id}", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue