[record-minmax] Tidy RecordMinMax #11282
Workflow file for this run
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: Check PR commit | |
on: | |
pull_request: | |
branches: | |
- master | |
- release/* | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-commit-message: | |
name: Check commit message | |
runs-on: ubuntu-20.04 | |
# Skip on draft, check on draft -> ready | |
if: github.repository_owner == 'Samsung' && github.event.pull_request.draft == false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Checkout PR head commit | |
# Checkout Action use merge commit as default | |
ref: ${{ github.event.pull_request.head.sha }} | |
# Fetch all history and branch (default: 1) | |
fetch-depth: 0 | |
- name: Get commit body | |
run: | | |
git log origin/${GITHUB_BASE_REF}..HEAD --format=%b > commit_msg.txt | |
sed '/^$/d' commit_msg.txt > commit_body.txt | |
- name: Check signed-off | |
run: | | |
# Check string starting from "Signed-off-by:" | |
count=$(cat commit_body.txt | grep 'Signed-off-by:' | wc -l) | |
if [[ ! "$count" -ge "1" ]]; then | |
echo "Your commit message does not contain the expected signoff information." | |
exit 1 | |
fi | |
echo "Signed-off-by is OK" | |
- name: Check body words | |
# Run if check_signed_off step is failed | |
if: ${{ always() }} | |
run: | | |
count=$(cat commit_body.txt | sed '/Signed-off-by:/d' | wc -w) | |
echo "Commit body word check: $count words" | |
if [[ "$count" -lt "5" ]]; then | |
echo "The body of your commit does not satisfy this repository requirements." | |
echo "The body needs to contain at least 5 words." | |
exit 1 | |
fi |