Skip to content

Commit b89738e

Browse files
committed
Make name of forked repos include the original user
1 parent 8875ce7 commit b89738e

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/src/scverse_template_scripts/cruft_prs.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,13 @@ def cruft_update(con: GitHubConnection, tag_name: str, repo: GHRepo, path: Path,
189189
return True
190190

191191

192-
def get_fork(con: GitHubConnection, repo: GHRepo) -> GHRepo:
193-
if fork := next((f for f in repo.get_forks() if f.owner.id == con.user.id), None):
192+
def get_fork(con: GitHubConnection, repo: GHRepo, name: str) -> GHRepo:
193+
if fork := next(
194+
(f for f in repo.get_forks() if f.owner.id == con.user.id and f.name == name),
195+
None,
196+
):
194197
return fork
195-
fork = repo.create_fork()
198+
fork = repo.create_fork(name=name)
196199
return retry_with_backoff(
197200
lambda: con.gh.get_repo(fork.id),
198201
retries=n_retries,
@@ -207,7 +210,7 @@ def make_pr(con: GitHubConnection, release: GHRelease, repo_url: str) -> None:
207210

208211
# create fork, populate branch, do PR from it
209212
origin = con.gh.get_repo(repo_url.removeprefix("https://github.com/"))
210-
repo = get_fork(con, origin)
213+
repo = get_fork(con, origin, pr.repo_id)
211214
with TemporaryDirectory() as td:
212215
updated = cruft_update(con, release.tag_name, repo, Path(td), pr)
213216
if updated:

0 commit comments

Comments
 (0)