tet123/.github/workflows/sanity-check.yml

33 lines
1.5 KiB
YAML
Raw Normal View History

2020-06-26 16:14:35 +02:00
name: Commit message format check
on:
# ATTENTION: See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
# re security implications of using this trigger; in particular, no code from PR branches must
# be executed in any flows triggered by it
pull_request_target:
branches: [ master ]
jobs:
build:
name: Commit message
runs-on: ubuntu-latest
steps:
- name: Commit messages in format DBZ-xxx
2021-09-16 05:58:11 +02:00
id: check
env:
2021-09-16 05:58:11 +02:00
pull_request_number: ${{ github.event.pull_request.number }}
run: |
2021-09-16 05:58:11 +02:00
curl --silent -X "GET" https://api.github.com/repos/debezium/debezium/pulls/$pull_request_number/commits | jq '.[] | {message: .commit.message}' | jq -r '.message' >> COMMIT_MESSAGE.txt
while IFS=" " read -r MSG;
do
if [[ ! $MSG =~ (^DBZ-[[:digit:]]+)|(\[release\])|(\[jenkins-jobs\])|(\[docs\]) ]]; then
echo "::set-output name=PREFIX::false"
fi
done < COMMIT_MESSAGE.txt
- name: Create Comment
2021-09-16 05:58:11 +02:00
if: ${{ steps.check.outputs.PREFIX == 'false' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Hi @${{ github.event.pull_request.user.login }}, thanks for your contribution. Please prefix the commit message(s) with the [DBZ-xxx JIRA issue key](https://github.com/debezium/debezium/blob/master/CONTRIBUTE.md#making-changes).