Flaky-test bot: reopen existing issues (#12727)
If a test becomes flaky again, reopen the old issue.
This commit is contained in:
parent
e48110d7c6
commit
de12d69e6b
1 changed files with 10 additions and 1 deletions
|
@ -53,7 +53,10 @@ class FlakyReporter implements Reporter {
|
||||||
|
|
||||||
const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
|
const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
|
||||||
// Fetch all existing issues with the flaky-test label.
|
// 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();
|
const issues = await issuesRequest.json();
|
||||||
for (const flake of this.flakes) {
|
for (const flake of this.flakes) {
|
||||||
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
|
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
|
||||||
|
@ -61,6 +64,12 @@ class FlakyReporter implements Reporter {
|
||||||
|
|
||||||
if (existingIssue) {
|
if (existingIssue) {
|
||||||
console.log(`Found issue ${existingIssue.number} for ${flake}, adding comment...`);
|
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`, {
|
await fetch(`${existingIssue.url}/comments`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers,
|
headers,
|
||||||
|
|
Loading…
Reference in a new issue