diff --git a/github/client.go b/github/client.go index 64976fd..c3ea252 100644 --- a/github/client.go +++ b/github/client.go @@ -225,7 +225,7 @@ func (c *Client) doRequest(ctx context.Context, method, reqURL string, accept st timer := time.NewTimer(delay) select { case <-timer.C: - timer.Stop() // no-op after fire, releases runtime resources promptly + timer.Stop() // no-op after fire; kept for symmetry with the ctx.Done case case <-ctx.Done(): timer.Stop() return nil, ctx.Err() diff --git a/github/files.go b/github/files.go index 2531b8e..9f04941 100644 --- a/github/files.go +++ b/github/files.go @@ -81,7 +81,7 @@ func (c *Client) ListContents(ctx context.Context, owner, repo, path string) ([] if err := json.Unmarshal(body, &entries); err != nil { var single entry if err2 := json.Unmarshal(body, &single); err2 != nil { - return nil, fmt.Errorf("parse contents JSON: %w", err2) + return nil, fmt.Errorf("parse contents JSON: as array: %v; as object: %w", err, err2) } // Guard against empty objects ({}) or unexpected shapes that // unmarshal successfully but carry no useful data. diff --git a/github/pr.go b/github/pr.go index 2db9304..e9bea5a 100644 --- a/github/pr.go +++ b/github/pr.go @@ -127,6 +127,9 @@ func (c *Client) GetPullRequestFiles(ctx context.Context, owner, repo string, nu // Returns nil (not an empty slice) when there are no statuses or check runs. // If the commit statuses endpoint fails (e.g. 404 for an unknown SHA), the // function returns immediately without attempting the check-runs endpoint. +// If the check-runs endpoint fails after statuses were fetched successfully, +// the function returns an error (not a partial result) so callers always get +// either a complete view or a clear error signal. func (c *Client) GetCommitStatuses(ctx context.Context, owner, repo, sha string) ([]vcs.CommitStatus, error) { var result []vcs.CommitStatus @@ -192,7 +195,7 @@ func mapCheckRunStatus(conclusion *string) string { case "failure", "action_required", "timed_out": return "failure" case "cancelled", "skipped", "neutral": - return "success" // non-blocking + return "success" // non-blocking: these do not indicate a blocking failure per GitHub check suite semantics case "stale", "waiting": return "pending" default: