-
-
Save ffflorian/71de2e72a3788fbc63fa5ead8e3b5fde to your computer and use it in GitHub Desktop.
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})" |
@Ismoh github.event.head_commit.message
is not exposed in PRs.
Ah yea makes sense. I used it on push. Thanks for pointing out. My bad!
As ::set-env
is now deprecated you can fiddle around with envs or define outputs to manage it.
As
::set-env
is now deprecated you can fiddle around with envs or define outputs to manage it.
Thanks so much 👍
In case someone landed here for a quick solution. The ${{ github.event.head_commit.message }}
is still working fine. FYI.
@neotan no, it doesn't work in PR events as mentioned above (only push). I came here because it doesn't work in PR events.
@neotan no, it doesn't work in PR events as mentioned above (only push).
ah, my bad! Overlooked the mentions above, ya it works in pushing. Thanks for pointing out!
This thread helped me get where I needed to go!
Just btw you can use
${{ github.event.head_commit.message }}
instead of
https://gist.github.com/ffflorian/71de2e72a3788fbc63fa5ead8e3b5fde#file-get-commit-yml-L19