Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ updates:
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
labels:
- "dependencies"
- "github-actions"
- "ci/cd"
commit-message:
prefix: "chore(deps)"
include: "scope"
150 changes: 150 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# GitHub Labels Configuration
# These labels are used by the PR auto-labeler workflow
#
# To sync these labels with your repository, you can use:
# https://github.com/EndBug/label-sync
# or create them manually in GitHub UI
#
# Color scheme:
# - Blue/Purple: New features and enhancements
# - Red/Orange: Bugs and breaking changes
# - Teal/Cyan: Documentation and testing
# - Yellow: Refactoring and caution
# - Green: CI/CD and automation
# - Gray: Infrastructure and builds

# Type labels (based on conventional commits)
- name: enhancement
color: 'A28EFF'
description: '✨ Enhancement - improves existing functionality'

- name: bug
color: 'FF1744'
description: '🐛 Bug fix - resolves an issue or error (conventional commit: fix)'

- name: documentation
color: '00E5FF'
description: '📚 Documentation improvements - updates docs, comments, or guides (conventional commit: docs)'

- name: style
color: 'FF4081'
description: '💅 Code style changes - formatting, whitespace, missing semicolons (conventional commit: style)'

- name: refactor
color: 'FFEA00'
description: '♻️ Code refactoring - restructuring without changing behavior (conventional commit: refactor)'

- name: performance
color: 'AA00FF'
description: '⚡ Performance improvements - optimizations and speed enhancements (conventional commit: perf)'

- name: testing
color: '00E676'
description: '🧪 Test updates - adding or updating tests (conventional commit: test)'

- name: maintenance
color: 'FFB300'
description: '🔧 Maintenance tasks - routine upkeep and housekeeping (conventional commit: chore)'

- name: ci/cd
color: '00C853'
description: '🚀 CI/CD changes - workflow automation and deployment (conventional commit: ci)'

- name: build
color: '9E9E9E'
description: '🏗️ Build system changes - build tools, dependencies, config (conventional commit: build)'

- name: revert
color: '78909C'
description: '⏪ Revert changes - undoing previous commits (conventional commit: revert)'

- name: breaking change
color: 'FF3D00'
description: '💥 BREAKING CHANGE - incompatible API changes requiring major version bump'

# Size labels (auto-added based on PR size)
- name: size/XS
color: '00E676'
description: '🐭 Extra small change - less than 10 lines modified'

- name: size/S
color: '76FF03'
description: '🐿️ Small change - less than 50 lines modified'

- name: size/M
color: 'FDD835'
description: '🐕 Medium change - less than 200 lines modified'

- name: size/L
color: 'FF6D00'
description: '🐘 Large change - less than 500 lines modified'

- name: size/XL
color: 'D50000'
description: '🦖 Extra large change - 500+ lines modified, consider splitting'

# Additional useful labels
- name: dependencies
color: '2196F3'
description: '📦 Dependency updates - library and package upgrades'

- name: security
color: 'D50000'
description: '🔒 Security fixes - patches for vulnerabilities'

- name: good first issue
color: '7C4DFF'
description: '👋 Good for newcomers - great starting point for new contributors'

- name: help wanted
color: '00BFA5'
description: '🙏 Help wanted - seeking community input or assistance'

- name: priority: high
color: 'FF1744'
description: '🔴 High priority - needs immediate attention'

- name: priority: medium
color: 'FF9100'
description: '🟡 Medium priority - should be addressed soon'

- name: priority: low
color: '69F0AE'
description: '🟢 Low priority - can be deferred'

- name: question
color: 'E040FB'
description: '❓ Question - seeking clarification or discussion'

- name: wontfix
color: 'CFD8DC'
description: '⛔ Won\'t fix - this will not be worked on'

- name: duplicate
color: 'B0BEC5'
description: '🔄 Duplicate - this issue or PR already exists elsewhere'

- name: invalid
color: 'FDD835'
description: '❌ Invalid - not applicable or incorrect'

- name: stale
color: 'EEEEEE'
description: '⏳ Stale - no recent activity, may be closed'

- name: blocked
color: 'C62828'
description: '🚫 Blocked - waiting on external dependency or decision'

# Additional workflow labels
- name: chore
color: '00B8D4'
description: '🧹 Repository chore or maintenance work'

- name: feature
color: 'FF6EC7'
description: '🌟 New feature - adds brand new functionality (conventional commit: feat)'

- name: hacktoberfest-accepted
color: 'FF8500'
description: '🎃 Hacktoberfest accepted - auto-applied in October for contributors'
161 changes: 161 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Commit Lint

on:
pull_request:
branches: [main, develop]
types: [opened, synchronize, reopened, edited]

permissions:
contents: read
pull-requests: read

jobs:
lint-commits:
name: Validate Commit Messages
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate commit messages
run: |
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

echo -e "${BLUE}Validating commit messages...${NC}"

# Get the base branch
BASE_REF="${{ github.event.pull_request.base.sha }}"
HEAD_REF="${{ github.event.pull_request.head.sha }}"

# Get all commits in this PR
COMMITS=$(git log --pretty=format:"%H %s" "$BASE_REF".."$HEAD_REF")

# Conventional commit pattern
# Types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
PATTERN="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9_-]+\))?(!)?: .+"

INVALID_COMMITS=()
VALID_COUNT=0
TOTAL_COUNT=0

while IFS= read -r line; do
[[ -z "$line" ]] && continue

TOTAL_COUNT=$((TOTAL_COUNT + 1))
HASH=$(echo "$line" | awk '{print $1}')
MESSAGE=$(echo "$line" | cut -d' ' -f2-)

if [[ "$MESSAGE" =~ $PATTERN ]]; then
echo -e "${GREEN}✓${NC} $MESSAGE"
VALID_COUNT=$((VALID_COUNT + 1))
else
echo -e "${RED}✗${NC} $MESSAGE"
INVALID_COMMITS+=("$HASH: $MESSAGE")
fi
done <<< "$COMMITS"

echo ""
echo -e "${BLUE}Summary:${NC}"
echo -e " Total commits: $TOTAL_COUNT"
echo -e " Valid commits: ${GREEN}$VALID_COUNT${NC}"
echo -e " Invalid commits: ${RED}$((TOTAL_COUNT - VALID_COUNT))${NC}"

# If there are invalid commits, fail the check
if [ ${#INVALID_COMMITS[@]} -gt 0 ]; then
echo ""
echo -e "${RED}❌ Found invalid commit messages:${NC}"
echo ""
for commit in "${INVALID_COMMITS[@]}"; do
echo -e " ${RED}✗${NC} $commit"
done
echo ""
echo -e "${YELLOW}Commit messages must follow the Conventional Commits specification:${NC}"
echo ""
echo -e " Format: ${BLUE}type(scope): description${NC}"
echo ""
echo -e " Types:"
echo -e " ${GREEN}feat${NC} - New feature"
echo -e " ${GREEN}fix${NC} - Bug fix"
echo -e " ${GREEN}docs${NC} - Documentation changes"
echo -e " ${GREEN}style${NC} - Code style changes (formatting, etc.)"
echo -e " ${GREEN}refactor${NC} - Code refactoring"
echo -e " ${GREEN}perf${NC} - Performance improvements"
echo -e " ${GREEN}test${NC} - Test changes"
echo -e " ${GREEN}chore${NC} - Build process or auxiliary tool changes"
echo -e " ${GREEN}ci${NC} - CI configuration changes"
echo -e " ${GREEN}build${NC} - Build system changes"
echo -e " ${GREEN}revert${NC} - Revert a previous commit"
echo ""
echo -e " Examples:"
echo -e " ${BLUE}feat(auth): Add login functionality${NC}"
echo -e " ${BLUE}fix(api): Resolve null pointer exception${NC}"
echo -e " ${BLUE}docs(readme): Update README with installation steps${NC}"
echo -e " ${BLUE}feat(auth)!: Breaking change in auth flow${NC}"
echo ""
echo -e " For more info: ${BLUE}https://www.conventionalcommits.org${NC}"

# Add to step summary
{
echo "## ❌ Commit Message Validation Failed"
echo ""
echo "The following commits do not follow the Conventional Commits specification:"
echo ""
for commit in "${INVALID_COMMITS[@]}"; do
echo "- \`$commit\`"
done
echo ""
echo "### Required Format"
echo ""
echo "\`\`\`"
echo "type(scope): description"
echo "\`\`\`"
echo ""
echo "### Valid Types"
echo ""
echo "- \`feat\` - New feature"
echo "- \`fix\` - Bug fix"
echo "- \`docs\` - Documentation changes"
echo "- \`style\` - Code style changes"
echo "- \`refactor\` - Code refactoring"
echo "- \`perf\` - Performance improvements"
echo "- \`test\` - Test changes"
echo "- \`chore\` - Maintenance tasks"
echo "- \`ci\` - CI changes"
echo "- \`build\` - Build system changes"
echo ""
echo "### Examples"
echo ""
echo "- \`feat(auth): Add login functionality\`"
echo "- \`fix(api): Resolve null pointer exception\`"
echo "- \`docs(readme): Update README\`"
echo ""
echo "Learn more: [Conventional Commits](https://www.conventionalcommits.org)"
} >> $GITHUB_STEP_SUMMARY

exit 1
fi

echo ""
echo -e "${GREEN}✓ All commit messages are valid${NC}"

# Add success to step summary
{
echo "## ✅ Commit Message Validation Passed"
echo ""
echo "All $VALID_COUNT commit(s) follow the Conventional Commits specification."
} >> $GITHUB_STEP_SUMMARY

exit 0
Loading