From 9c5d68f3a1ca1c58db17689308813291d8c73a29 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 5 Dec 2023 19:51:05 -0800 Subject: [PATCH] Only accept merge if PR squash --- action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index f0428fc..1185f4e 100644 --- a/action.yml +++ b/action.yml @@ -43,8 +43,12 @@ runs: elif [ ${{ github.event_name }} == 'push' ] then echo "Event type: push" - echo ${{ github.event.head_commit.message }} - # pr=$(echo ${{ github.event.head_commit }} | grep -Eo "pr-[0-9]+" | cut -d '-' -f2) + pr=$(echo ${{ github.event.head_commit.message }} | grep -Eo "pr-[0-9]+" | cut -d '-' -f2) + if [ -z "${{ pr }}" ] + then + echo "No PR number found. Was this push triggered by a squashed PR merge?" + pr="" + fi else echo "Event type: unknown or unexpected" fi