Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Flaky-test bot: reopen existing issues #12727

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion playwright/flaky-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,23 @@ class FlakyReporter implements Reporter {

const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
// Fetch all existing issues with the flaky-test label.
const issuesRequest = await fetch(`${GITHUB_API_URL}/repos/${REPO}/issues?labels=${LABEL}`, { headers });
const issuesRequest = await fetch(
`${GITHUB_API_URL}/repos/${REPO}/issues?labels=${LABEL}&state=all&per_page=100&sort=created`,
{ headers },
);
const issues = await issuesRequest.json();
for (const flake of this.flakes) {
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
const existingIssue = issues.find((issue) => issue.title === title);

if (existingIssue) {
console.log(`Found issue ${existingIssue.number} for ${flake}, adding comment...`);
// Ensure that the test is open
await fetch(existingIssue.url, {
method: "PATCH",
headers,
body: JSON.stringify({ state: "open" }),
});
await fetch(`${existingIssue.url}/comments`, {
method: "POST",
headers,
Expand Down
Loading