Skip to content

Commit

Permalink
Install pre-commit on create_commit_pull_request
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 15, 2024
1 parent 35c7d21 commit 9f4d478
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions github_app_geo_project/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,16 @@ def create_commit_pull_request(
branch: str, new_branch: str, message: str, body: str, repo: github.Repository.Repository
) -> tuple[bool, github.PullRequest.PullRequest | None]:
"""Do a commit, then create a pull request."""
if os.path.exists(".pre-commit-config.yaml"):
proc = subprocess.run( # nosec # pylint: disable=subprocess-run-check
["pre-commit", "install"],
capture_output=True,
encoding="utf-8",
timeout=10,
)
proc_message = ansi_proc_message(proc)
proc_message.title = "Install pre-commit"
_LOGGER.debug(proc_message)
if not create_commit(message):
return False, None
return create_pull_request(branch, new_branch, message, body, repo)
Expand Down

0 comments on commit 9f4d478

Please sign in to comment.