-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_committer.py
More file actions
54 lines (40 loc) · 1.93 KB
/
github_committer.py
File metadata and controls
54 lines (40 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import subprocess
from datetime import datetime, timedelta
def run_cmd(cmd, env=None):
subprocess.run(cmd, shell=True, env=env)
# Git config (ensure it's set)
run_cmd("git config user.name 'mandar1045'")
run_cmd("git config user.email 'mandar1045@users.noreply.github.com'")
commits_per_day = 30
start_date = datetime(2026, 2, 9, 10, 0, 0)
dates = [start_date + timedelta(days=i) for i in range(4)]
# Stage 1: Add gitignore and remove any tracked venv/pycache files
run_cmd("git rm -r --cached venv/ __pycache__/ .pytest_cache/ 2>/dev/null")
env = os.environ.copy()
env['GIT_AUTHOR_DATE'] = dates[0].isoformat()
env['GIT_COMMITTER_DATE'] = dates[0].isoformat()
# Commit the actual project files on the first commit
run_cmd("git add -A", env)
res = subprocess.run("git commit -m \"Initial commit: Complete API Version Migration System with Semantic Mapper\"", shell=True, env=env)
total_commits = 1 if res.returncode == 0 else 0
for day_idx, current_date in enumerate(dates):
for i in range(commits_per_day):
if total_commits >= 120:
break
# Skip the very first iteration if we just did the initial commit
if day_idx == 0 and i == 0 and total_commits == 1:
continue
commit_time = current_date + timedelta(minutes=i*15)
iso_time = str(commit_time)
env['GIT_AUTHOR_DATE'] = iso_time
env['GIT_COMMITTER_DATE'] = iso_time
with open("migration_updates.log", "a") as f:
f.write(f"Update entry {total_commits}: system optimization and routine checks.\n")
run_cmd("git add migration_updates.log", env)
run_cmd(f"git commit -m \"Routine system update {total_commits}\"", env)
total_commits += 1
# Try pushing to main or master
res_main = subprocess.run("git push -u origin main", shell=True)
if res_main.returncode != 0:
subprocess.run("git push -u origin master", shell=True)