name: 'Get commit message' outputs: msg: value: ${{ steps.action_output.outputs.msg }} runs: using: "composite" steps: - name: Find commit message (on push) if: github.event_name == 'push' shell: bash run: | AUTHOR_NAME="${{ github.event.head_commit.author.name }}" AUTHOR_EMAIL="${{ github.event.head_commit.author.email }}" TSTAMP="${{ github.event.head_commit.timestamp }}" echo "commit ${{ github.event.head_commit.id }}" >> /tmp/commit_msg.txt echo "Author: ${AUTHOR_NAME}<${AUTHOR_EMAIL}>" >> /tmp/commit_msg.txt echo "Date: ${TSTAMP}" >> /tmp/commit_msg.txt echo "" >> /tmp/commit_msg.txt echo "${{ github.event.head_commit.message }}" >> /tmp/commit_msg.txt - name: Find commit message (PR) shell: bash id: checkout_code if: github.event_name == 'pull_request' run: | echo "+++++ head commit message +++++" echo "$(git log -1 --no-merges)" echo "+++++++++++++++++++++++++++++++" echo "hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" git checkout ${{ github.event.pull_request.head.sha }} echo "$(git log -1 --no-merges)" >> /tmp/commit_msg.txt - shell: bash id: action_output run: | DELIMITER="EOF_FILE_CONTENT_$(date +%s)" # Using timestamp to make it more unique echo "msg<<$DELIMITER" >> "$GITHUB_OUTPUT" cat /tmp/commit_msg.txt >> "$GITHUB_OUTPUT" echo "$DELIMITER" >> "$GITHUB_OUTPUT" echo "----- got commit message ---" cat /tmp/commit_msg.txt echo "----------------------------" - name: Cleanup Find commit message (PR) shell: bash if: github.event_name == 'pull_request' run: | git checkout ${{ steps.checkout_code.outputs.hash }}