Skip to content

Import the code from the self provisioning plugin #5

Import the code from the self provisioning plugin

Import the code from the self provisioning plugin #5

Workflow file for this run

name: 'Pull Request Check'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Commit Message
run: |
nlines=-1
for (( N=1; N<=${{github.event.pull_request.commits}}; N++ ))
do
prev_lines=$(($nlines+1))
nlines=0
while IFS= read -r line
do
nlines=$((nlines+1))
if (( $nlines == $prev_lines+1 )); then
if ! [[ "$line" =~ ^\[#[0-9]+\]\ .+$|^\[NO-ISSUE\]\ .+$ ]]; then
echo "[ commit $N ]: Commit message should begin with [#nnn] or [NO-ISSUE], followed by a space."
echo "but it is: $line"
exit 1
fi
fi
done <<< $(git log --format=%B -n $N ${{github.event.pull_request.head.sha}})
done