|
1 | 1 | import os
|
2 |
| -from argparse import Namespace |
3 | 2 | from pathlib import Path
|
4 | 3 | from typing import Optional
|
5 | 4 |
|
@@ -101,25 +100,23 @@ def update_dependencies(repo: RepoSandbox) -> Optional[str]:
|
101 | 100 | )
|
102 | 101 |
|
103 | 102 |
|
104 |
| -def update_action(args: Namespace) -> None: |
105 |
| - for repo_url in args.repo: |
106 |
| - with RepoSandbox(repo_url, args.dry_run) as repo: |
107 |
| - repo.logger.info("Starting update") |
108 |
| - actions = [] |
109 |
| - msg_body = "" |
110 |
| - cruft_msg = update_cruft(repo) |
111 |
| - if cruft_msg: |
112 |
| - msg_body += cruft_msg |
113 |
| - actions.append("project template cruft") |
114 |
| - deps_msg = update_dependencies(repo) |
115 |
| - if deps_msg: |
116 |
| - msg_body += deps_msg |
117 |
| - actions.append("dependencies") |
118 |
| - if not msg_body: |
119 |
| - repo.logger.info("Already up to date") |
120 |
| - continue |
121 |
| - actions_str = ", ".join(actions) |
122 |
| - message = f"Update {actions_str}\n\n{msg_body}" |
123 |
| - repo.logger.info(f"Updated {actions_str}") |
124 |
| - repo.commit_changes(message) |
125 |
| - repo.open_pr(message) |
| 103 | +def update_action(repo: RepoSandbox) -> None: |
| 104 | + repo.logger.info("Starting update") |
| 105 | + actions = [] |
| 106 | + msg_body = "" |
| 107 | + cruft_msg = update_cruft(repo) |
| 108 | + if cruft_msg: |
| 109 | + msg_body += cruft_msg |
| 110 | + actions.append("project template cruft") |
| 111 | + deps_msg = update_dependencies(repo) |
| 112 | + if deps_msg: |
| 113 | + msg_body += deps_msg |
| 114 | + actions.append("dependencies") |
| 115 | + if not msg_body: |
| 116 | + repo.logger.info("Already up to date") |
| 117 | + return |
| 118 | + actions_str = ", ".join(actions) |
| 119 | + message = f"Update {actions_str}\n\n{msg_body}" |
| 120 | + repo.logger.info(f"Updated {actions_str}") |
| 121 | + repo.commit_changes(message) |
| 122 | + repo.open_pr(message) |
0 commit comments