Skip to content

Commit

Permalink
feat: added get commit message step
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsonbrsilva committed Apr 26, 2024
1 parent 0949cd8 commit 05f76ff
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/create-pre-release-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 05f76ff

Please sign in to comment.