Skip to content

Commit

Permalink
CI: update get commit message (#258)
Browse files Browse the repository at this point in the history
* updated & tested get commit message

* test
  • Loading branch information
andiradulescu authored Jul 25, 2024
1 parent 0480a88 commit 8cddf8a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ jobs:
echo 'LAST_COMMIT_MESSAGE<<EOF'
if [ "${{ github.event_name }}" == "push" ]; then
echo "${{ github.event.head_commit.message }}"
elif [ "${{ github.event_name }}" == "workflow_run" ]; then
echo "${{ github.event.workflow_run.head_commit.message }}"
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
COMMIT_URL=$(echo "${{ github.event.repository.commits_url }}" | sed "s|{/sha}|/${{ github.sha }}|")
echo "$(curl -s "$COMMIT_URL" | jq -r '.commit.message')"
elif [ "${{ github.event_name }}" == "pull_request" ]; then
echo "$(curl -s '${{ github.event.pull_request.commits_url }}' | jq -r '.[-1].commit.message')"
PR_COMMIT_URL=$(echo "${{ github.event.repository.commits_url }}" | sed "s|{/sha}|/${{ github.event.pull_request.head.sha }}|")
echo "$(curl -s "$PR_COMMIT_URL" | jq -r '.commit.message')"
fi
echo EOF
} | tee -a $GITHUB_ENV
Expand Down

0 comments on commit 8cddf8a

Please sign in to comment.