-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add lefthook for git hooks and sync contributing docs #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1 @@ | ||
| --- | ||
| blank_issues_enabled: false | ||
| contact_links: | ||
| - name: GitHub Discussions | ||
| url: https://github.com/TomerFi/version-bumper-action/discussions/ | ||
| about: You can also use Discussions for questions and ideas. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # https://github.com/apps/auto-me-bot | ||
| --- | ||
| pr: | ||
| conventionalTitle: | ||
| tasksList: |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| assert_lefthook_installed: true | ||
|
|
||
| pre-commit: | ||
| parallel: true | ||
| commands: | ||
| no-commit-to-master: | ||
| run: '[ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]' | ||
| actionlint: | ||
| glob: ".github/workflows/*.{yml,yaml}" | ||
| run: actionlint {staged_files} | ||
| editorconfig-checker: | ||
| run: editorconfig-checker {staged_files} | ||
| aicfg-link: | ||
| glob: | ||
| - CLAUDE.md | ||
| - AGENTS.md | ||
| - .claude/** | ||
| - .agents/** | ||
| run: uvx aicfg link agents --to claude-code --ci |
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,99 +1,54 @@ | ||
| # Contributing to *version-bumper-action* | ||
|
|
||
| :clap: First, thank you for taking the time to contribute. :clap: | ||
| Thank you for contributing. This guide covers the essentials. | ||
|
|
||
| ## How to Contribute | ||
| ## AI Policy | ||
|
|
||
| - Fork the repository | ||
| - Create a new branch on your fork | ||
| - Commit your work following [Conventional Commits](https://conventionalcommits.org) | ||
| - Create a pull request against the `master` branch | ||
| - All PRs are squash merged, so your PR title becomes the commit message | ||
| This project has a clear AI policy — read [AI_POLICY.md](AI_POLICY.md) and follow it. You're responsible for everything you submit. | ||
|
|
||
| ## Conventional Commits | ||
| ## Setup | ||
|
|
||
| This project uses conventional commits, and **this is critical** because the action itself uses conventional commits to determine version bumps. | ||
|
|
||
| Use these prefixes: | ||
| - `feat:` - New feature (triggers minor bump) | ||
| - `fix:` - Bug fix (triggers patch bump) | ||
| - `docs:` - Documentation changes only | ||
| - `chore:` - Maintenance tasks, dependency updates | ||
| - `refactor:` - Code refactoring | ||
| - `test:` - Test changes | ||
|
|
||
| Breaking changes (major bump) should include `BREAKING CHANGE:` in the commit body. | ||
|
|
||
| ## Testing | ||
| ```bash | ||
| git clone <repo-url> | ||
| cd version-bumper-action | ||
| ``` | ||
|
|
||
| All changes are tested automatically via the `.github/workflows/test_action.yml` workflow. The test suite covers: | ||
| - Automatic version bumping (patch, minor, major) | ||
| - Manual version bumping | ||
| - Custom labels | ||
| - Output parsing | ||
| See [AGENTS.md](AGENTS.md) for linting and testing commands. | ||
|
|
||
| Tests run on every PR. Make sure they pass before requesting review. | ||
| ## Local Checks | ||
|
|
||
| ## Local Development | ||
| This project uses [**lefthook**](https://github.com/evilmartians/lefthook) for Git hooks. Install with `lefthook install`. | ||
|
|
||
| ### Linting | ||
| The pre-commit hook enforces: | ||
|
|
||
| Validate action.yml and workflows locally before pushing: | ||
| - **Branch protection** — blocks commits directly to `master` | ||
| - **Workflow validation** — actionlint validates GitHub Actions workflows | ||
| - **EditorConfig** — editorconfig-checker enforces consistent file formatting | ||
| - **Assistant files** — aicfg keeps project instructions in sync; run `uvx aicfg link agents --to claude-code --ci` to link | ||
|
|
||
| ```bash | ||
| actionlint | ||
| # Auto-installed by `lefthook install` | ||
| # Runs automatically on every commit (unless on master, which is blocked) | ||
| ``` | ||
|
|
||
| Install actionlint: | ||
| ```bash | ||
| # macOS (Homebrew) | ||
| brew install actionlint | ||
|
|
||
| # Linux (download binary) | ||
| # See https://github.com/rhysd/actionlint/releases | ||
| To run checks manually against all files: | ||
|
|
||
| # Or aqua | ||
| aqua g -i actionlint | ||
| ```bash | ||
| actionlint | ||
| editorconfig-checker | ||
| uvx aicfg link agents --to claude-code --ci | ||
| ``` | ||
|
|
||
| ## AI-Assisted Development | ||
|
|
||
| This project is configured for AI-assisted maintenance: | ||
|
|
||
| ### CodeRabbit | ||
| - Automated code reviews on all PRs | ||
| - Reviews action.yml for shell script best practices and action structure | ||
| - Reviews workflows for security and efficiency | ||
| - Address review comments and use `@coderabbitai resolve` when fixed | ||
|
|
||
| ### Cursor IDE | ||
| - **Project Rules:** See `.cursor/rules/project-rules.mdc` for project conventions | ||
| - Bash scripting guidelines for inline scripts | ||
| - Conventional commit requirements | ||
| - Testing requirements | ||
| - **Commands:** See `.cursor/commands/` for available commands | ||
| - `lint` - Run actionlint locally to validate action.yml and workflows | ||
|
|
||
| ### Third-Party Tools | ||
| - **Dependabot:** Automatically updates GitHub Actions dependencies | ||
| - **actionlint:** Lints action.yml and workflow files in CI (validates YAML and inline shell scripts) | ||
|
|
||
| ## Updating version-bumper Dependency | ||
|
|
||
| The action depends on the [@tomerfi/version-bumper](https://github.com/TomerFi/version-bumper) npm package. This is managed automatically: | ||
|
|
||
| - The `.github/workflows/new_version_bumper.yml` workflow detects new releases | ||
| - Automatically creates a PR with the updated version | ||
| - Simply review and merge the PR | ||
|
|
||
| Manual updates (if needed): | ||
| 1. Update `VB_VERSION` in `action.yml` | ||
| 2. Test via CI | ||
| 3. Submit PR | ||
| ## Commit Style | ||
|
|
||
| ## Project Maintenance | ||
| - Conventional commits: `feat:`, `fix:`, `docs:`, `chore:`, `refactor:`, `test:` | ||
| - One logical change per commit | ||
|
|
||
| - PRs are reviewed by [@TomerFi](https://github.com/TomerFi) (see [CODEOWNERS](.github/CODEOWNERS)) | ||
| - All PRs must pass CI checks before merging | ||
| - Keep the README usage example current (automated during releases) | ||
| ## PR Process | ||
|
|
||
| 1. Branch from `master` with a conventional name: `feat/add-input`, `fix/bump-error` | ||
| 2. Use a conventional PR title (`feat:`, `fix:`, `docs:`, etc.). | ||
| 3. Commit with a descriptive message | ||
| 4. Run all checks before submitting | ||
| 5. Open PR with a clear description of what changed and why | ||
| 6. Address feedback |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.