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.
-
Commitizen relies on tags in order to perform an incremental release, and the
commitizen-branchhook relies onorigin/HEADbeing set to the default branch, so you must passfetch-depth: 0tocheckout. -
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/[email protected]
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.
Please refer to
README.md of ScribeMD/rootless-docker.
The contents:write
permission
is required to bump the project version via Commitizen unless bump is false.
Please refer to CHANGELOG.md.