mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Add option to initialize repository with labels (#6061)
* Add optional label sets on repo creation * Fix CRLF * Instead of hardcoding default, make it the helper * Move label set init out of repo init Add a new error for the router Combine router label init with repo creation label init Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add issue labels to Swagger for repo creation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update models/issue_label.go Co-Authored-By: Lauris BH <lauris@nix.lv> * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
@@ -1098,6 +1098,7 @@ type CreateRepoOptions struct {
|
||||
Description string
|
||||
OriginalURL string
|
||||
Gitignores string
|
||||
IssueLabels string
|
||||
License string
|
||||
Readme string
|
||||
IsPrivate bool
|
||||
@@ -1394,6 +1395,13 @@ func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err
|
||||
return nil, fmt.Errorf("initRepository: %v", err)
|
||||
}
|
||||
|
||||
// Initialize Issue Labels if selected
|
||||
if len(opts.IssueLabels) > 0 {
|
||||
if err = initalizeLabels(sess, repo.ID, opts.IssueLabels); err != nil {
|
||||
return nil, fmt.Errorf("initalizeLabels: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
_, stderr, err := process.GetManager().ExecDir(-1,
|
||||
repoPath, fmt.Sprintf("CreateRepository(git update-server-info): %s", repoPath),
|
||||
git.GitExecutable, "update-server-info")
|
||||
|
Reference in New Issue
Block a user