0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-09-30 04:05:24 +02:00

add workflow

This commit is contained in:
Lunny Xiao 2025-01-08 17:25:02 -08:00
parent f2c7d32484
commit fb12ed211e
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// Copyright 2025 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package project
import "code.gitea.io/gitea/models/db"
type WorkflowEvent string
const (
WorkflowEventItemAddedToProject WorkflowEvent = "item_added_to_project"
WorkflowEventItemReopened WorkflowEvent = "item_reopened"
WorkflowEventItemClosed WorkflowEvent = "item_closed"
WorkflowEventCodeChangesRequested WorkflowEvent = "code_changes_requested"
WorkflowEventCodeReviewApproved WorkflowEvent = "code_review_approved"
WorkflowEventPullRequestMerged WorkflowEvent = "pull_request_merged"
WorkflowEventAutoArchiveItems WorkflowEvent = "auto_archive_items"
WorkflowEventAutoAddToProject WorkflowEvent = "auto_add_to_project"
WorkflowEventAutoCloseIssue WorkflowEvent = "auto_close_issue"
)
type ProjectWorkflow struct {
ID int64
ProjectID int64 `xorm:"index"`
WorkflowEvent WorkflowEvent `xorm:"index"`
}
func init() {
db.RegisterModel(new(ProjectWorkflow))
}

View File

@ -1383,6 +1383,9 @@ func registerRoutes(m *web.Router) {
m.Group("/{username}/{reponame}/projects", func() {
m.Get("", repo.Projects)
m.Get("/{id}", repo.ViewProject)
m.Group("/{id}/workflows", func() {
m.Get("", repo.Workflows)
})
m.Group("", func() { //nolint:dupl
m.Get("/new", repo.RenderNewProject)
m.Post("/new", web.Bind(forms.CreateProjectForm{}), repo.NewProjectPost)