From 237756ddc53cf66133224a0c36c7d19b3aa7cd64 Mon Sep 17 00:00:00 2001 From: himself65 Date: Wed, 22 Mar 2023 01:11:14 -0500 Subject: [PATCH] ci: add merge-check.yml --- .github/workflows/merge-check.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/merge-check.yml diff --git a/.github/workflows/merge-check.yml b/.github/workflows/merge-check.yml new file mode 100644 index 0000000000..3d33b3936e --- /dev/null +++ b/.github/workflows/merge-check.yml @@ -0,0 +1,29 @@ +name: Merge Check +on: + merge_group: + types: [checks_requested] + +jobs: + check_commit_run: + name: Check commit run + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + const assert = (condition, message) => { + if (!condition) { + throw new Error(message) + } + } + const { data } = await github.rest.checks.listSuitesForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.payload.merge_group.head_ref, + }) + const names = data.check_runs.map((run) => run.name) + assert(names.includes('E2E Test (1/4)'), 'E2E Test (1/4) not found') + assert(names.includes('E2E Test (2/4)'), 'E2E Test (2/4) not found') + assert(names.includes('E2E Test (3/4)'), 'E2E Test (3/4) not found') + assert(names.includes('E2E Test (4/4)'), 'E2E Test (4/4) not found') + assert(names.includes('Unit Test'), 'Unit Test not found')