MCPcopy Index your code
hub / github.com/git-bug/git-bug / createRepository

Function createRepository

bridge/gitlab/export_test.go:294–313  ·  view source on GitHub ↗

create repository need a token with scope 'repo'

(ctx context.Context, name string, token *auth.Token)

Source from the content-addressed store, hash-verified

292
293// create repository need a token with scope 'repo'
294func createRepository(ctx context.Context, name string, token *auth.Token) (int, error) {
295 client, err := buildClient(defaultBaseURL, token)
296 if err != nil {
297 return 0, err
298 }
299
300 project, _, err := client.Projects.CreateProject(
301 &gitlab.CreateProjectOptions{
302 Name: gitlab.String(name),
303 },
304 gitlab.WithContext(ctx),
305 )
306 if err != nil {
307 return 0, err
308 }
309
310 // fmt.Println("Project URL:", project.WebURL)
311
312 return project.ID, nil
313}
314
315// delete repository need a token with scope 'delete_repo'
316func deleteRepository(ctx context.Context, project int, token *auth.Token) error {

Callers 1

TestGitlabPushPullFunction · 0.70

Calls 2

buildClientFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected