mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 03:56:54 +00:00
21 lines
No EOL
673 B
Python
21 lines
No EOL
673 B
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
|
|
def main():
|
|
projen_process = subprocess.run('yarn projen', shell=True)
|
|
|
|
if projen_process.returncode != 0:
|
|
print(f'Error: "yarn projen" failed with exit status {projen_process.returncode}')
|
|
sys.exit(projen_process.returncode)
|
|
|
|
git_status = subprocess.run('git diff', capture_output=True, shell=True, text=True)
|
|
if git_status.stdout.strip():
|
|
print("Uncommitted changes found:")
|
|
print(git_status.stdout)
|
|
print('Have you forgotten to run "yarn projen" and commit changes?')
|
|
sys.exit(1)
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main()) |