@@ -32,41 +32,46 @@ def _run(cmd: list[str], cwd: Path, check: bool = True) -> subprocess.CompletedP
3232
3333def render_and_push (repo_root : Path , commit_message : str ) -> bool :
3434 """
35- 1. Run render_papers.py (rebuild README blocks)
36- 2. Run update_papers_badge.py (update paper count badge)
37- 3. git add data/ README.md docs/
38- 4. git commit --no-verify
39- 5. git push
35+ 1. git pull --rebase (sync with remote first)
36+ 2. Run render_papers.py (rebuild README blocks)
37+ 3. Run update_papers_badge.py (update paper count badge)
38+ 4. git add data/ README.md docs/
39+ 5. git commit --no-verify
40+ 6. git push
4041
4142 Returns True if a commit was made, False if nothing changed.
4243 """
4344 scripts = repo_root / "scripts"
4445
45- # Step 1: render README
46+ # Step 1: pull latest from remote before committing
47+ logger .info ("Pulling latest from origin…" )
48+ _run (["git" , "pull" , "--rebase" ], cwd = repo_root )
49+
50+ # Step 2: render README
4651 logger .info ("Running render_papers.py…" )
4752 _run ([_PYTHON , str (scripts / "render_papers.py" )], cwd = repo_root )
4853
49- # Step 2 : update badge
54+ # Step 3 : update badge
5055 logger .info ("Running update_papers_badge.py…" )
5156 _run ([_PYTHON , str (scripts / "update_papers_badge.py" )], cwd = repo_root )
5257
53- # Step 3 : check for changes
58+ # Step 4 : check for changes
5459 status = _run (["git" , "status" , "--porcelain" ], cwd = repo_root , check = False )
5560 if not status .stdout .strip ():
5661 logger .info ("Nothing to commit — working tree clean." )
5762 return False
5863
59- # Step 4 : stage relevant paths
64+ # Step 5 : stage relevant paths
6065 _run (["git" , "add" , "data/" , "README.md" , "docs/" ], cwd = repo_root , check = False )
6166
62- # Step 5 : commit
67+ # Step 6 : commit
6368 logger .info ("Committing: %s" , commit_message )
6469 _run (
6570 ["git" , "commit" , "--no-verify" , "-m" , commit_message ],
6671 cwd = repo_root ,
6772 )
6873
69- # Step 6 : push
74+ # Step 7 : push
7075 logger .info ("Pushing to origin…" )
7176 _run (["git" , "push" ], cwd = repo_root )
7277
0 commit comments