···2129 }
21302131 // choose a name for a fork
2132- forkName := f.Name
000002133 // this check is *only* to see if the forked repo name already exists
2134 // in the user's account.
2135 existingRepo, err := db.GetRepo(
2136 rp.db,
2137 db.FilterEq("did", user.Did),
2138- db.FilterEq("name", f.Name),
2139 )
2140 if err != nil {
2141- if errors.Is(err, sql.ErrNoRows) {
2142- // no existing repo with this name found, we can use the name as is
2143- } else {
2144 log.Println("error fetching existing repo from db", "err", err)
2145 rp.pages.Notice(w, "repo", "Failed to fork this repository. Try again later.")
2146 return
2147 }
2148 } else if existingRepo != nil {
2149- // repo with this name already exists, append random string
2150- forkName = fmt.Sprintf("%s-%s", forkName, randomString(3))
02151 }
2152 l = l.With("forkName", forkName)
2153
···2129 }
21302131 // choose a name for a fork
2132+ forkName := r.FormValue("repo_name")
2133+ if forkName == "" {
2134+ rp.pages.Notice(w, "repo", "Repository name cannot be empty.")
2135+ return
2136+ }
2137+2138 // this check is *only* to see if the forked repo name already exists
2139 // in the user's account.
2140 existingRepo, err := db.GetRepo(
2141 rp.db,
2142 db.FilterEq("did", user.Did),
2143+ db.FilterEq("name", forkName),
2144 )
2145 if err != nil {
2146+ if !errors.Is(err, sql.ErrNoRows) {
002147 log.Println("error fetching existing repo from db", "err", err)
2148 rp.pages.Notice(w, "repo", "Failed to fork this repository. Try again later.")
2149 return
2150 }
2151 } else if existingRepo != nil {
2152+ // repo with this name already exists
2153+ rp.pages.Notice(w, "repo", "A repository with this name already exists.")
2154+ return
2155 }
2156 l = l.With("forkName", forkName)
2157
···21 - `manual`: The workflow can be triggered manually.
22- `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.
2324-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:
2526```yaml
27when:
···21 - `manual`: The workflow can be triggered manually.
22- `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.
2324+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:
2526```yaml
27when: