From 05f76ffb303e66ec5bf1c4d77d675e9e0eba06f4 Mon Sep 17 00:00:00 2001 From: Davidson Bruno Date: Fri, 26 Apr 2024 11:38:43 -0300 Subject: [PATCH] feat: added get commit message step --- .github/workflows/create-pre-release-template.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-pre-release-template.yml b/.github/workflows/create-pre-release-template.yml index 0419ed0..e3c7ede 100644 --- a/.github/workflows/create-pre-release-template.yml +++ b/.github/workflows/create-pre-release-template.yml @@ -30,13 +30,19 @@ jobs: is_major_change: ${{ steps.check_major_change.outputs.is_major_change }} needs: get_last_version steps: - - name: Checkout code - uses: actions/checkout@v4 - + - name: Get commit message + id: get_commit_message + run: | + commit_sha=${{ github.event.pull_request.head.sha }} + commit_message=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/commits/$commit_sha" \ + | jq -r '.commit.message') + echo "commit_message=$commit_message" >> $GITHUB_OUTPUT + echo "Last commit message: '$commit_message'" - name: Check if new commit is major change id: check_major_change run: | - commit_message=${{ github.event.head_commit.message }} + commit_message=${{ steps.get_commit_message.outputs.commit_message }} major_change_regex="(^FIRST RELEASE:.*$)|(^BREAKING CHANGE:.*$)|(^[^\s]+!:.*$)" if [[ "$commit_message" =~ $breaking_change_regex ]]; then