Skip to content
Success

Changes

Summary

  1. refactor(flaky-tests): simplify GitHub types and API usage, remove (commit: 8369115) (details)
Commit 83691152ea8fa148a7c0a037fdb2d89e217edbc2 by noreply
refactor(flaky-tests): simplify GitHub types and API usage, remove custom wrappers (#4567)

## Summary

Simplify GitHub-related code in `flaky-tests`: remove custom wrapper
layer and use Octokit types/APIs directly.

### Changes

1. **Remove custom `GitHubClient` wrapper class** (~120 lines) 
`GitHubClient` wrapped 5 Octokit API methods (`searchIssues`,
`createIssue`, `reopenIssue`, `addLabels`, `addComment`), each manually
mapping response fields to a custom `GitHubIssueApi` interface. Now
calls Octokit's native REST APIs directly.

2. **Remove `GitHubIssueApi` and `OctokitLike` interfaces** 
No more custom interfaces — use `Octokit` type directly from
`@octokit/rest`.

3. **Flatten helper functions** 
Extract Octokit calls into module-level standalone functions
(`searchIssues`, `createIssue`, etc.) instead of class instance methods.

4. **Test at Octokit mock level** 
Tests no longer mock `GitHubClient`. Instead, inject a mock Octokit
instance via the `octokit` constructor option.

5. **Fix GitHub API deprecation warning** 
Add `X-GitHub-Api-Version: 2026-03-10` header to use the latest API
version.

### Files Changed

- `tools/reporters/ci/flaky-tests/core/GithubIssueManager.ts` — major
simplification
- `tools/reporters/ci/flaky-tests/core/GithubIssueManager.test.ts` —
updated mocking strategy
- `tools/reporters/ci/flaky-tests/deno.json` / `deno.lock` — dependency
updates
- `tools/reporters/ci/flaky-tests/render/HtmlRenderer.ts` — label text
optimization

---------

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
(commit: 8369115)
The file was modifiedtools/reporters/ci/flaky-tests/render/HtmlRenderer.ts (diff)
The file was modifiedtools/reporters/ci/flaky-tests/deno.json (diff)
The file was modifiedtools/reporters/ci/flaky-tests/core/GithubIssueManager.ts (diff)
The file was modifiedtools/reporters/ci/flaky-tests/deno.lock (diff)
The file was modifiedtools/reporters/ci/flaky-tests/core/GithubIssueManager.test.ts (diff)