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

Commit

Permalink
Flaky-test bot: reopen existing issues (#12727)
Browse files Browse the repository at this point in the history
If a test becomes flaky again, reopen the old issue.
  • Loading branch information
richvdh authored Jul 4, 2024
1 parent e48110d commit de12d69
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit de12d69

Please sign in to comment.