From 265b8eb68a6906251c24f571fa7c273794a022b5 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Wed, 6 Nov 2024 16:38:07 +0100 Subject: [PATCH] Update check-for-integration-result.yml --- .../check-for-integration-result.yml | 78 ++++++++++--------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/.github/workflows/check-for-integration-result.yml b/.github/workflows/check-for-integration-result.yml index eade928ab73..f66c0effd51 100644 --- a/.github/workflows/check-for-integration-result.yml +++ b/.github/workflows/check-for-integration-result.yml @@ -6,7 +6,7 @@ on: pull_request: # for debugging jobs: - # fetch comments, if integration-test comment is present, use that to label pass or fail. remove in-progress. + # note: this workflow always passes, it does not fail when integration tests are failing check-for-integration-result: # if: ${{ github.event.issue.pull_request }} runs-on: ubuntu-latest @@ -16,51 +16,53 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | + const INTEGRATION_LABEL_NAMES = { + // synced with https://github.com/primer/react/labels?q=integration-tests + skipped: 'integration-tests: skipped manually', + recommended: 'integration-tests: recommended', + failing: 'integration-tests: failing', + passing: 'integration-tests: passing' + }; + const issue = { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo - } - + }; + + const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue(issue); + const integrationLabels = currentLabels + .map(label => label.name) + .filter(label => label.startsWith('integration-tests:')); + + if (integrationLabels.includes(INTEGRATION_LABEL_NAMES.skipped)) return; + const result = await github.rest.issues.listComments(issue); - const integrationComments = result.data.filter(c => c.user.login == 'primer-integration[bot]' && c.body.includes('