Skip to content

ScribeMD/pre-commit-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

pre-commit-action

GitHub Action: Try Me Test Workflow Status Copy/Paste: 0%

Automated Updates: Renovate Package Management: Poetry Git Hooks: pre-commit Commit Style: Conventional Commits Releases: Semantic Versioning Code Style: Prettier Code Style: EditorConfig Editor: Visual Studio Code

GitHub Action Optimized for Running ScribeMD/pre-commit-hooks

Install asdf, Node.js, Python, and Poetry; use Poetry to install pre-commit; run pre-commit hooks; and optionally use commitizen-action to bump the project version. Assume the presence of .tool-versions specifying versions for Node.js, Python, and Poetry as well as poetry.lock. Cache Poetry dependencies. Cache Node.js packages specified in .mega-linter.yaml, .pre-commit-config.yaml, and/or .pre-commit-hooks.yaml. Since pre-commit supports Docker, cache Docker images. Cache pre-commit hook environments. Set origin/HEAD to the default branch to support the commitizen-branch hook. Skip the commitizen-branch hook and no-commit-to-branch hook on main to avoid false positives. Finally, uninstall pre-commit hooks to avoid breaking subsequent Git commands. This relies on specifying default_install_hook_types in .pre-commit-config.yaml.

Usage

  • Commitizen relies on tags in order to perform an incremental release, and the commitizen-branch hook relies on origin/HEAD being set to the default branch, so you must pass fetch-depth: 0 to checkout.

  • Add the following step before your first use of Docker since rootless-docker is used to avoid permission issues:

    - name: Install and run pre-commit hooks.
      uses: ScribeMD/pre-commit-action@0.9.129

Inputs

Optional

bump

default: true

If true, run commitizen-action on push to main to commit a version bump and tag a release if there are any release-worthy changes. Uses your GITHUB_TOKEN, which must have write access to your repository.

Supported Runners

Please refer to README.md of ScribeMD/rootless-docker.

Permissions

The contents:write permission is required to bump the project version via Commitizen unless bump is false.

Changelog

Please refer to CHANGELOG.md.