mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 20:35:00 +00:00
feat: Add git push dry-run check before version bump
This commit is contained in:
parent
34334ad8b8
commit
17c9ba2c68
1 changed files with 15 additions and 1 deletions
|
@ -69,6 +69,20 @@ def main():
|
||||||
print("Error: The main branch and origin/main have diverged.")
|
print("Error: The main branch and origin/main have diverged.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Function to check if we can push to the origin repository
|
||||||
|
def check_push_access():
|
||||||
|
print("Checking push access to origin repository...")
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "push", "--dry-run", "origin"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print("Error: Cannot push to origin repository.")
|
||||||
|
print(result.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
print("Push access to origin repository confirmed.")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
dry_run = args.dry_run
|
dry_run = args.dry_run
|
||||||
|
|
||||||
|
@ -76,7 +90,7 @@ def main():
|
||||||
check_branch()
|
check_branch()
|
||||||
check_working_directory_clean()
|
check_working_directory_clean()
|
||||||
check_main_branch_up_to_date()
|
check_main_branch_up_to_date()
|
||||||
# do a `git push --dry-run origin` check before proceeding. ai!
|
check_push_access()
|
||||||
|
|
||||||
new_version_str = args.new_version
|
new_version_str = args.new_version
|
||||||
if not re.match(r"^\d+\.\d+\.\d+$", new_version_str):
|
if not re.match(r"^\d+\.\d+\.\d+$", new_version_str):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue