Skip to content

Comments

Add content policy enforcement for commits, PRs, and issues#405

Merged
nikblanchet merged 2 commits intomainfrom
content-policy-hooks
Nov 28, 2025
Merged

Add content policy enforcement for commits, PRs, and issues#405
nikblanchet merged 2 commits intomainfrom
content-policy-hooks

Conversation

@nikblanchet
Copy link
Owner

Summary

  • Add commit-msg hook (Husky) to reject forbidden emojis in commit messages
  • Add GitHub Action to validate PR descriptions, issues, and comments
  • Forbidden emojis: robot, checkmark, X, rocket, prohibited, sparkles, heart
  • Reject redundant Claude attributions (both Co-Authored-By and Generated with)

Files Changed

  • .husky/commit-msg - Local commit message validation
  • .github/workflows/content-policy.yml - GitHub Action for PR/issue/comment validation

Post-Merge Setup

To make the check block merging:

  1. Go to repo Settings > Branches > Branch protection rules
  2. Add/edit rule for main branch
  3. Enable "Require status checks to pass before merging"
  4. Select "validate" from the status check list
  5. Save changes

Note: The workflow must run at least once before it appears in the status check list.

Generated with Claude Code
Steered and verified by @nikblanchet

- Add commit-msg hook (Husky) to reject forbidden emojis in commit messages
- Add GitHub Action to validate PR descriptions, issues, and comments
- Forbidden emojis: robot, checkmark, X, rocket, prohibited, sparkles, heart
- Reject redundant Claude attributions (Co-Authored-By + Generated with)

Generated with [Claude Code](https://claude.com/claude-code)
Steered and verified by @nikblanchet
Critical fixes:
- Propagate exit code from local hook (was silently ignored)
- Use full email in Co-Authored-By check to avoid false positives
- Extract commit message only (before diff markers) to prevent false positives

Important fixes:
- Use printf instead of echo for robustness
- Add terminal check for color codes (works in CI logs)
- Add case-insensitive matching for Claude signatures
- Add 'reopened' trigger to GitHub Action

Minor improvements:
- Add set -e for better error handling
- Add permissions block to GitHub Action
- Show which emoji was detected in error message
- Add bypass instructions to error messages

Generated with [Claude Code](https://claude.com/claude-code)
Steered and verified by @nikblanchet
@nikblanchet nikblanchet merged commit e570d5b into main Nov 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant