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