Update all (major) #2088
This file contains 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: 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: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Bot commits check | |
id: bot-check | |
env: | |
pull_request_number: ${{ github.event.pull_request.number }} | |
run: | | |
AUTHOR=$(curl --silent -X "GET" https://api.github.com/repos/debezium/debezium-ui/pulls/$pull_request_number/commits | jq '.[] | {author: .commit.author.name}' | jq -r '.author') | |
if [[ $AUTHOR =~ 'Renovate Bot' ]]; then | |
echo "name=BOT-COMMIT::true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit messages in format DBZ-xxx | |
if: ${{ steps.bot-check.outputs.BOT-COMMIT != 'true' }} | |
id: check | |
env: | |
pull_request_number: ${{ github.event.pull_request.number }} | |
run: | | |
COMMIT_MSGS=$(curl --silent -X "GET" https://api.github.com/repos/debezium/debezium-ui/pulls/$pull_request_number/commits | jq '.[] | {message: .commit.message}' | jq '.message' | cut -c 2-) | |
NON_PREFIX_COMMITS="" | |
while IFS= read -r line ; | |
do | |
line=${line%\"} | |
echo "-> checking: $line" | |
if [[ ! $line =~ (^DBZ-[[:digit:]]+)|(\[docs\])|(\[ci\]) ]]; then | |
NON_PREFIX_COMMITS="${NON_PREFIX_COMMITS} -> ${line} \n" | |
fi | |
done <<< "$COMMIT_MSGS" | |
if [[ $NON_PREFIX_COMMITS != "" ]]; then | |
echo "========================================================================" | |
echo " COMMIT MESSAGES WITH MISSING \"DBZ\" PREFIX" | |
echo "========================================================================" | |
echo -e "$NON_PREFIX_COMMITS" | |
echo "name=PREFIX::false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Comment | |
if: ${{ steps.check.outputs.PREFIX == 'false' }} | |
uses: peter-evans/create-or-update-comment@v4 | |
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/main/CONTRIBUTE.md#making-changes). |