Created
August 4, 2020 14:17
-
-
Save ffflorian/71de2e72a3788fbc63fa5ead8e3b5fde to your computer and use it in GitHub Desktop.
GH actions: Get commit message in a PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Notify on Pull Request | |
on: | |
pull_request: | |
branches: [dev] | |
jobs: | |
send_notification: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.after}} | |
- name: Get Commit Message | |
run: | | |
MSG=$(git log --format=%B -n 1 ${{github.event.after}}) | |
echo "::set-env name=COMMIT_MESSAGE::${MSG}" | |
- name: Echo commit message | |
run: echo "Commit SHA: ${{github.event.after}}, commit message: ${{env.COMMIT_MESSAGE}} (or ${COMMIT_MESSAGE})" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ah, my bad! Overlooked the mentions above, ya it works in pushing. Thanks for pointing out!