Skip to content

0123456789 0123456789 0123456789 01234567890 #4

0123456789 0123456789 0123456789 01234567890

0123456789 0123456789 0123456789 01234567890 #4

Workflow file for this run

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