Skip to content

Commit

Permalink
Switch to new authentication format for PyGithub
Browse files Browse the repository at this point in the history
PyGithub has deprecated passing the token directly as a positional
argument when initializing the client.

This commit updates all occurrences to use the new
`Github(auth=github.Auth.Token(...))` format.
  • Loading branch information
simu committed Oct 9, 2023
1 parent db77923 commit 9297a28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion commodore/dependency_syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def sync_dependencies(
deps = read_dependency_list(dependency_list, depfilter)
dep_count = len(deps)

gh = github.Github(config.github_token)
gh = github.Github(auth=github.Auth.Token(config.github_token))
# Keep track of how many PRs we've created to better avoid running into rate limits
update_count = 0
for i, dn in enumerate(deps, start=1):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_dependency_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def test_ensure_pr(tmp_path: Path, config: Config, pr_exists: bool):
pname = "projectsyn/package-foo"
dependency_syncer.ensure_branch(p, "template-sync")

gh = github.Github(config.github_token)
gh = github.Github(auth=github.Auth.Token(config.github_token))
gr = gh.get_repo(pname)

msg = dependency_syncer.ensure_pr(
Expand Down Expand Up @@ -286,7 +286,7 @@ def test_ensure_pr_no_permission(tmp_path: Path, config: Config, pr_exists: bool
pname = "projectsyn/package-foo"
dependency_syncer.ensure_branch(p, "template-sync")

gh = github.Github(config.github_token)
gh = github.Github(auth=github.Auth.Token(config.github_token))
gr = gh.get_repo(pname)

msg = dependency_syncer.ensure_pr(p, pname, gr, "template-sync", [], "")
Expand Down Expand Up @@ -323,7 +323,7 @@ def test_ensure_pr_comment(tmp_path: Path, config: Config):
pname = "projectsyn/package-foo"
dependency_syncer.ensure_branch(p, "template-sync")

gh = github.Github(config.github_token)
gh = github.Github(auth=github.Auth.Token(config.github_token))
gr = gh.get_repo(pname)

msg = dependency_syncer.ensure_pr(
Expand Down

0 comments on commit 9297a28

Please sign in to comment.