(ctx context.Context, client *github.Client, ref string)
| 180 | } |
| 181 | |
| 182 | func (m *operationsFile) updateFromGithub(ctx context.Context, client *github.Client, ref string) error { |
| 183 | commit, resp, err := client.Repositories.GetCommit(ctx, descriptionsOwnerName, descriptionsRepoName, ref, nil) |
| 184 | if err != nil { |
| 185 | return err |
| 186 | } |
| 187 | if resp.StatusCode != 200 { |
| 188 | return fmt.Errorf("unexpected status code: %v", resp.Status) |
| 189 | } |
| 190 | ops, err := getOpsFromGithub(ctx, client, ref) |
| 191 | if err != nil { |
| 192 | return err |
| 193 | } |
| 194 | if !operationsEqual(m.OpenapiOps, ops) { |
| 195 | m.OpenapiOps = ops |
| 196 | m.GitCommit = commit.GetSHA() |
| 197 | } |
| 198 | return nil |
| 199 | } |
| 200 | |
| 201 | func loadOperationsFile(filename string) (*operationsFile, error) { |
| 202 | b, err := os.ReadFile(filename) |
no test coverage detected