|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +GitHub Actions Mobsuccess is a GitHub Action that enforces Mobsuccess compliance policies in repositories. It validates pull request titles, branch names, and other repository standards during CI/CD workflows. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +npm ci # Install dependencies |
| 13 | +npm run eslint # Lint JavaScript code |
| 14 | +npm run prettier # Check code formatting |
| 15 | +npm run test # Run tests with coverage (Jest) |
| 16 | +``` |
| 17 | + |
| 18 | +## Architecture |
| 19 | + |
| 20 | +**Entry Point Flow**: `index.js` → `action.js` (dispatcher) → specific action handler in `lib/actions/` |
| 21 | + |
| 22 | +**Three Main Actions**: |
| 23 | + |
| 24 | +- `validate-pr`: Validates branch names and PR titles against conventions |
| 25 | +- `after-pr-merged`: Post-merge automation (rebase notifications for sub-branches) |
| 26 | +- `changelog`: Generates changelog from releases and PRs |
| 27 | + |
| 28 | +**Key Modules**: |
| 29 | + |
| 30 | +- `lib/branch.js`: Branch naming convention validator (regex-based) |
| 31 | +- `lib/pullRequest.js`: PR title validation (Conventional Commits format) |
| 32 | +- `lib/actions/pullRequest.js`: Full PR validation logic including GitHub API calls |
| 33 | +- `lib/actions/octokit.js`: GitHub API client wrapper |
| 34 | + |
| 35 | +## Conventions |
| 36 | + |
| 37 | +**Branch Naming**: `{type}/{name}` where type is one of: `feat|fix|hotfix|chore|docs|refactor|test|revert|ci|perf|style|build|change|remove|poc|mobsuccessbot|dependabot` |
| 38 | + |
| 39 | +Special prefixes: `renovate/`, `copilot/`, `claude/`, `crowdin/update-translations` |
| 40 | + |
| 41 | +**Sub-branches**: Branches based on non-main branches must use `baseRef--` prefix (e.g., `develop--feat/something`) |
| 42 | + |
| 43 | +**PR Titles**: Conventional Commits format: `{type}({scope})!: {description}` |
| 44 | + |
| 45 | +- Types: `hotfix|feat|fix|chore|docs|refactor|test|revert|build|ci|perf|style|change|remove|poc` |
| 46 | +- Scope and `!` (breaking change marker) are optional |
| 47 | +- Revert format: `revert {original message}` |
| 48 | + |
| 49 | +## Testing |
| 50 | + |
| 51 | +Tests use Jest with parametrized test cases (`test.each()`). Run `npm run test` for coverage report. |
| 52 | + |
| 53 | +Test files mirror source files: `lib/branch.test.js`, `lib/pullRequest.test.js` |
0 commit comments