Feat/passkey integration (#518) #752
This file contains hidden or 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: Pre-commit Hook Validation | |
| on: | |
| push: | |
| branches: [main, develop, staging] | |
| pull_request: | |
| branches: [main, develop, staging] | |
| jobs: | |
| validate-pre-commit: | |
| name: Validate Pre-commit Hooks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for bypassed commits | |
| run: | | |
| echo "π Checking for bypassed pre-commit hooks..." | |
| # Get recent commits | |
| commits=$(git log --oneline -10) | |
| # Check for emergency bypass commits | |
| bypass_commits=$(echo "$commits" | grep -i "emergency.*bypass\|no-verify\|skip.*hook" || true) | |
| if [ -n "$bypass_commits" ]; then | |
| echo "β οΈ Found commits that bypassed pre-commit hooks:" | |
| echo "$bypass_commits" | |
| echo "" | |
| echo "β Emergency bypasses are not allowed in protected branches." | |
| echo "Please fix the issues and commit properly." | |
| exit 1 | |
| else | |
| echo "β No bypassed commits found." | |
| fi | |
| - name: Validate commit message format | |
| run: | | |
| echo "π Validating commit message format..." | |
| # Conventional commit regex | |
| commit_regex='^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?: .{1,50}' | |
| # Get commits in this push/PR | |
| if [ "$GITHUB_EVENT_NAME" = "push" ]; then | |
| commits=$(git log --pretty=format:"%s" ${{ github.event.before }}..${{ github.event.after }}) | |
| else | |
| commits=$(git log --pretty=format:"%s" origin/main..HEAD) | |
| fi | |
| invalid_commits="" | |
| while IFS= read -r message; do | |
| # Skip empty lines and git-generated merge commits | |
| if [ -z "$message" ] || echo "$message" | grep -qE "^Merge (branch|pull request|remote-tracking branch|[0-9a-f]{7,40}) "; then | |
| continue | |
| fi | |
| if ! echo "$message" | grep -qE "$commit_regex"; then | |
| invalid_commits="$invalid_commits\n$message" | |
| fi | |
| done <<< "$commits" | |
| if [ -n "$invalid_commits" ]; then | |
| echo "β Invalid commit messages found:" | |
| echo -e "$invalid_commits" | |
| echo "" | |
| echo "β Please use conventional commit format:" | |
| echo " <type>(<scope>): <description>" | |
| exit 1 | |
| else | |
| echo "β All commit messages follow conventional format." | |
| fi | |
| - name: Check for console.log statements | |
| run: | | |
| echo "π Checking for console.log statements..." | |
| # Get changed files | |
| if [ "$GITHUB_EVENT_NAME" = "push" ]; then | |
| changed_files=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }}) | |
| else | |
| changed_files=$(git diff --name-only origin/main..HEAD) | |
| fi | |
| console_log_found=false | |
| for file in $changed_files; do | |
| if [[ "$file" =~ \.(ts|tsx|js|jsx)$ ]] && [ -f "$file" ]; then | |
| if grep -q "console\.log" "$file"; then | |
| echo "β Found console.log in $file" | |
| console_log_found=true | |
| fi | |
| fi | |
| done | |
| if [ "$console_log_found" = true ]; then | |
| echo "β Console.log statements found in changed files." | |
| echo "Please remove them before committing." | |
| exit 1 | |
| else | |
| echo "β No console.log statements found in changed files." | |
| fi | |
| - name: Check for TODO/FIXME comments | |
| run: | | |
| echo "π Checking for TODO/FIXME comments..." | |
| # Get changed files | |
| if [ "$GITHUB_EVENT_NAME" = "push" ]; then | |
| changed_files=$(git diff --name-only ${{ github.event.before }}..${{ github.event.after }}) | |
| else | |
| changed_files=$(git diff --name-only origin/main..HEAD) | |
| fi | |
| todo_found=false | |
| for file in $changed_files; do | |
| if [[ "$file" =~ \.(ts|tsx|js|jsx)$ ]] && [ -f "$file" ]; then | |
| if grep -q "TODO\|FIXME" "$file"; then | |
| echo "β οΈ Found TODO/FIXME in $file" | |
| todo_found=true | |
| fi | |
| fi | |
| done | |
| if [ "$todo_found" = true ]; then | |
| echo "β οΈ TODO/FIXME comments found in changed files." | |
| echo "Please address them before merging." | |
| # Don't fail the build, just warn | |
| else | |
| echo "β No TODO/FIXME comments found in changed files." | |
| fi |