MCPcopy Index your code
hub / github.com/google/go-github / updateFromGithub

Method updateFromGithub

tools/metadata/metadata.go:182–199  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, ref string)

Source from the content-addressed store, hash-verified

180}
181
182func (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
201func loadOperationsFile(filename string) (*operationsFile, error) {
202 b, err := os.ReadFile(filename)

Callers 1

RunMethod · 0.80

Calls 4

getOpsFromGithubFunction · 0.85
operationsEqualFunction · 0.85
GetCommitMethod · 0.45
GetSHAMethod · 0.45

Tested by

no test coverage detected