Enhance routers for the Actions runner operations (#33549) (#33555)

Backport #33549 

- Find the runner before deleting
- Move the main logic from `routers/web/repo/setting/runners.go` to
`routers/web/shared/actions/runners.go`.

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Lunny Xiao
2025-02-11 15:25:56 +08:00
committed by GitHub
co-authored by Jason Song wxiaoguang
parent 7c17d0a73e
commit 7794ff0874
5 changed files with 387 additions and 207 deletions
+6 -6
View File
@@ -460,11 +460,11 @@ func registerRoutes(m *web.Router) {
addSettingsRunnersRoutes := func() {
m.Group("/runners", func() {
m.Get("", repo_setting.Runners)
m.Combo("/{runnerid}").Get(repo_setting.RunnersEdit).
Post(web.Bind(forms.EditRunnerForm{}), repo_setting.RunnersEditPost)
m.Post("/{runnerid}/delete", repo_setting.RunnerDeletePost)
m.Post("/reset_registration_token", repo_setting.ResetRunnerRegistrationToken)
m.Get("", shared_actions.Runners)
m.Combo("/{runnerid}").Get(shared_actions.RunnersEdit).
Post(web.Bind(forms.EditRunnerForm{}), shared_actions.RunnersEditPost)
m.Post("/{runnerid}/delete", shared_actions.RunnerDeletePost)
m.Post("/reset_registration_token", shared_actions.ResetRunnerRegistrationToken)
})
}
@@ -1133,7 +1133,7 @@ func registerRoutes(m *web.Router) {
})
})
m.Group("/actions", func() {
m.Get("", repo_setting.RedirectToDefaultSetting)
m.Get("", shared_actions.RedirectToDefaultSetting)
addSettingsRunnersRoutes()
addSettingsSecretsRoutes()
addSettingsVariablesRoutes()