Report on Playwright flakes in the merge queue (#33750)

This commit is contained in:
Michael Telatynski
2026-06-04 18:03:19 +01:00
committed by GitHub
parent a7b70ee9cc
commit afc4e52df4
2 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -293,8 +293,8 @@ jobs:
--config=playwright-merge.config.ts \
./all-blob-reports
env:
# Only pass creds to the flaky-reporter on main branch runs
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}
# Only pass creds to the flaky-reporter on main branch runs, or in merge queues (knowing these may be false positives)
GITHUB_TOKEN: ${{ case(github.event_name == 'merge_group' || github.ref_name == 'develop', secrets.ELEMENT_BOT_TOKEN, '') }}
PLAYWRIGHT_HTML_TITLE: ${{ case(github.event_name == 'pull_request', format('Playwright Report PR-{0}', env.PR_NUMBER), 'Playwright Report') }}
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
@@ -139,7 +139,8 @@ class FlakyReporter implements Reporter {
console.log(flake);
}
const { GITHUB_TOKEN, GITHUB_API_URL, GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID } = process.env;
const { GITHUB_TOKEN, GITHUB_API_URL, GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID, GITHUB_EVENT_NAME } =
process.env;
if (!GITHUB_TOKEN) return;
const issues = await this.getAllIssues();
@@ -147,13 +148,17 @@ class FlakyReporter implements Reporter {
const title = ISSUE_TITLE_PREFIX + "`" + flake + "`";
const existingIssue = issues.find((issue) => issue.title === title);
const headers = { Authorization: `Bearer ${GITHUB_TOKEN}` };
const body = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`;
let body = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`;
if (GITHUB_EVENT_NAME === "merge_group") {
body += " (merge queue run, may be a false positive)";
}
const labels = [LABEL, ...results.map((test) => `${LABEL}-${test.parent.project()?.name}`)];
if (existingIssue) {
console.log(`Found issue ${existingIssue.number} for ${flake}, adding comment...`);
// Ensure that the test is open
// Ensure that the issue is open
await fetch(existingIssue.url, {
method: "PATCH",
headers,