Skip to content

fix(config): Update all timeouts to 20 seconds #16

fix(config): Update all timeouts to 20 seconds

fix(config): Update all timeouts to 20 seconds #16

Workflow file for this run

name: Commit Limits
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, dev]
jobs:
lint-commits:
name: Check commit sizes and branch naming
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check branch naming convention
if: github.event_name == 'pull_request'
run: |
branch_name="${{ github.head_ref }}"
# Define valid branch prefixes
valid_prefixes="feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert"
# Check if branch follows naming convention
if ! echo "$branch_name" | grep -E "^($valid_prefixes)/" > /dev/null; then
echo "❌ Branch name '$branch_name' doesn't follow naming convention"
echo "Branch names must start with one of: feat/, fix/, docs/, style/, refactor/, test/, chore/, perf/, ci/, build/, revert/"
exit 1
fi
echo "✅ Branch name follows convention"
- name: Check commit sizes
run: |
# For PRs, check all commits in the PR
if [ "${{ github.event_name }}" == "pull_request" ]; then
commits=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
else
# For pushes, just check the latest commit
commits=$(git rev-parse HEAD)
fi
failed=false
for commit in $commits; do
echo "Checking commit $commit"
# Get commit stats
files_changed=$(git diff-tree --no-commit-id --name-only -r $commit | wc -l)
lines_added=$(git diff-tree --no-commit-id --numstat -r $commit | awk '{sum+=$1} END {print sum}')
lines_deleted=$(git diff-tree --no-commit-id --numstat -r $commit | awk '{sum+=$2} END {print sum}')
total_lines=$((lines_added + lines_deleted))
echo " Files changed: $files_changed"
echo " Lines added: $lines_added"
echo " Lines deleted: $lines_deleted"
echo " Total lines changed: $total_lines"
# Check limits
if [ "$files_changed" -gt 30 ]; then
echo "❌ Commit changes too many files: $files_changed (max: 30)"
failed=true
fi
if [ "$total_lines" -gt 800 ]; then
echo "❌ Commit changes too many lines: $total_lines (max: 800)"
failed=true
fi
# Check for generated files (relaxed for initial setup)
if git diff-tree --no-commit-id --name-only -r $commit | grep -E "(Package\.resolved|\.pbxproj|\.xcodeproj)" > /dev/null; then
echo "⚠️ Warning: Commit includes generated files (allowed during setup phase)"
fi
done
if [ "$failed" = true ]; then
echo ""
echo "🚫 One or more commits exceed size limits"
echo "Please break large changes into smaller, focused commits"
exit 1
fi
echo ""
echo "✅ All commits within size limits"
- name: Check commit messages
if: github.event_name == 'pull_request'
run: |
# Check commit message format
commits=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
failed=false
for commit in $commits; do
message=$(git log --format=%s -n 1 $commit)
# Check conventional commit format
if ! echo "$message" | grep -E "^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?: .+" > /dev/null; then
echo "❌ Commit message doesn't follow conventional format: $message"
echo "Expected format: type(scope): description"
echo "Example: feat(inventory): add item search functionality"
failed=true
fi
done
if [ "$failed" = true ]; then
exit 1
fi
echo "✅ All commit messages follow convention"