Skip to content
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

release: skip git hooks #32

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion orchestra/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ def create_tags(
repo.git.add("pyproject.toml")
added = len([i for i in repo.index.diff("HEAD")])

# NOTE: exit gracefully if python files were modified, as we
# may not be able to run pre-commit hooks (depends on env setup)
if py_files := list(filter(lambda p: p.endswith(".py"), modified)):
msg = f"{repo.working_tree_dir}: python files modified: {py_files}\n"
msg += "Please commit in the dev environment so that pre-commit hooks can be run."
console.print(msg)
ErrorCodes.COMMIT_ERR.exit()

if added > 0:
try:
msg = invoke_editor(repo, next_version)
Expand All @@ -309,7 +317,7 @@ def create_tags(
console.print(format_exc(err, "Aborting commit!"))
ErrorCodes.COMMIT_ERR.exit()
else:
repo.index.commit(msg)
repo.index.commit(msg, skip_hooks=True)

console.print(
f"Creating tag: {next_version} @ [yellow]{repo.head.commit.hexsha[:7]}"
Expand Down
Loading