From 4f2f704962f960c42ca2bc3ca81c4c43767b22f2 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Wed, 29 Nov 2023 13:03:20 +0100 Subject: [PATCH] chore: make PR title check work as a merge_group check (#2987) --- .github/workflows/pr-title.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index dcb5dd5f8718..40556c5c7bcc 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -1,8 +1,9 @@ name: Check PR title for commit convention on: + merge_group: pull_request: - types: [opened, edited] + types: [opened, synchronize, reopened, edited] jobs: check-pr-title: @@ -12,6 +13,8 @@ jobs: uses: actions/github-script@v6 with: script: | - if (!/^(feat|fix|doc|style|refactor|test|chore|perf): .*[^.]($|\n\n)/.test(context.payload.pull_request.title)) { + const msg = context.payload.pull_request? context.payload.pull_request.title : context.payload.merge_group.head_commit.message; + console.log(`Message: ${msg}`) + if (!/^(feat|fix|doc|style|refactor|test|chore|perf): .*[^.]($|\n\n)/.test(msg)) { core.setFailed('PR title does not follow the Commit Convention (https://leanprover.github.io/lean4/doc/dev/commit_convention.html).'); }