| 73 | } |
| 74 | |
| 75 | func syncFork(client *api.Client, repo ghrepo.Interface, branch, SHA string, force bool) error { |
| 76 | path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "git", "refs", fmt.Sprintf("heads/%s", branch)) |
| 77 | if err != nil { |
| 78 | return err |
| 79 | } |
| 80 | body := map[string]any{ |
| 81 | "sha": SHA, |
| 82 | "force": force, |
| 83 | } |
| 84 | requestByte, err := json.Marshal(body) |
| 85 | if err != nil { |
| 86 | return err |
| 87 | } |
| 88 | requestBody := bytes.NewReader(requestByte) |
| 89 | return client.REST(repo.RepoHost(), "PATCH", path.String(), requestBody, nil) |
| 90 | } |