From f6c6b13fcb112b36a7a4259d816a2a2d058e248d Mon Sep 17 00:00:00 2001
From: rxu <rxu@mail.ru>
Date: Fri, 8 Jan 2021 22:03:39 +0700
Subject: [PATCH 1/2] [ticket/16675] Adjust checking commit messages

Check commit messages on both 'push' and 'pull_request' events.

PHPBB3-16675
---
 .github/workflows/tests.yml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 67172b19bc..98faae4e4a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -77,12 +77,10 @@ jobs:
                   .github/check-executable-files.sh ./
 
             - name: Check commit message
-              env:
-                  BRANCH: ${{ github.event.pull_request.base.sha }}
-                  PR_SHA: ${{ github.event.pull_request.head.sha }}
-              if: github.event.pull_request.head.sha != '' && github.event.pull_request.base.sha != ''
               run: |
-                  git-tools/commit-msg-hook-range.sh $BRANCH..$PR_SHA
+                  # Get previous merge commit to get commit range from
+                  export BRANCH=$(git rev-list --merges -n 1 HEAD^1)
+                  git-tools/commit-msg-hook-range.sh $BRANCH..$GITHUB_SHA
 
     # Tests for MySQL and MariaDB
     mysql-tests:

From 0d45825016a7551ab8d21f3206c360d7a771f4b9 Mon Sep 17 00:00:00 2001
From: rxu <rxu@mail.ru>
Date: Sun, 10 Jan 2021 15:20:28 +0700
Subject: [PATCH 2/2] [ticket/16675] Check commit messages on pull_request
 event only

PHPBB3-16675
---
 .github/workflows/tests.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 98faae4e4a..83c125afdd 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -77,9 +77,10 @@ jobs:
                   .github/check-executable-files.sh ./
 
             - name: Check commit message
+              env:
+                  BRANCH: ${{ github.event.pull_request.base.sha }}
+              if: github.event_name == 'pull_request'
               run: |
-                  # Get previous merge commit to get commit range from
-                  export BRANCH=$(git rev-list --merges -n 1 HEAD^1)
                   git-tools/commit-msg-hook-range.sh $BRANCH..$GITHUB_SHA
 
     # Tests for MySQL and MariaDB