0123456789 0123456789 0123456789 01234567890 #4
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: Enforce Short Title | |
on: | |
issues: | |
types: | |
- opened | |
pull_request: | |
types: | |
- opened | |
jobs: | |
enforce_short_title: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Title Length | |
id: title_check | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "issues" ]; then | |
title=$(jq -r '.issue.title' "$GITHUB_EVENT_PATH") | |
elif [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then | |
title=$(jq -r '.pull_request.title' "$GITHUB_EVENT_PATH") | |
fi | |
title_length=$(echo -n "$title" | wc -m) | |
if [ "$title_length" -ge 40 ]; then | |
echo "::error::Title length should be less than 40 characters." | |
exit 1 | |
fi | |
- name: Notify If Title Too Long | |
if: failure() | |
run: | | |
echo "Title length check failed. Please ensure the title is less than 40 characters." | |
exit 1 |