···21292129 }
2130213021312131 // choose a name for a fork
21322132- forkName := f.Name
21322132+ forkName := r.FormValue("repo_name")
21332133+ if forkName == "" {
21342134+ rp.pages.Notice(w, "repo", "Repository name cannot be empty.")
21352135+ return
21362136+ }
21372137+21332138 // this check is *only* to see if the forked repo name already exists
21342139 // in the user's account.
21352140 existingRepo, err := db.GetRepo(
21362141 rp.db,
21372142 db.FilterEq("did", user.Did),
21382138- db.FilterEq("name", f.Name),
21432143+ db.FilterEq("name", forkName),
21392144 )
21402145 if err != nil {
21412141- if errors.Is(err, sql.ErrNoRows) {
21422142- // no existing repo with this name found, we can use the name as is
21432143- } else {
21462146+ if !errors.Is(err, sql.ErrNoRows) {
21442147 log.Println("error fetching existing repo from db", "err", err)
21452148 rp.pages.Notice(w, "repo", "Failed to fork this repository. Try again later.")
21462149 return
21472150 }
21482151 } else if existingRepo != nil {
21492149- // repo with this name already exists, append random string
21502150- forkName = fmt.Sprintf("%s-%s", forkName, randomString(3))
21522152+ // repo with this name already exists
21532153+ rp.pages.Notice(w, "repo", "A repository with this name already exists.")
21542154+ return
21512155 }
21522156 l = l.With("forkName", forkName)
21532157
···2121 - `manual`: The workflow can be triggered manually.
2222- `branch`: This is a **required** field that defines which branches the workflow should run for. If used with the `push` event, commits to the branch(es) listed here will trigger the workflow. If used with the `pull_request` event, updates to pull requests targeting the branch(es) listed here will trigger the workflow. This field has no effect with the `manual` event.
23232424-For example, if you'd like define a workflow that runs when commits are pushed to the `main` and `develop` branches, or when pull requests that target the `main` branch are updated, or manually, you can do so with:
2424+For example, if you'd like to define a workflow that runs when commits are pushed to the `main` and `develop` branches, or when pull requests that target the `main` branch are updated, or manually, you can do so with:
25252626```yaml
2727when: