Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency PyGithub to v2 #859

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -218,10 +218,10 @@ def ensure_pr(
try:
if not has_sync_pr:
sync_pr = gr.create_pull(
f"Update from {deptype} template",
pr_body,
gr.default_branch,
branch_name,
title=f"Update from {deptype} template",
body=pr_body,
)
else:
sync_pr = [pr for pr in prs if pr.head.ref == branch_name][0]
Expand Down
13 changes: 8 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pyxdg = "0.28"
cruft = "2.15.0"
oauthlib = "3.2.2"
pyjwt = "2.8.0"
PyGithub = "1.59.1"
PyGithub = "2.1.1"
reclass-rs = "0.1.1"

[tool.poetry.dev-dependencies]
Expand Down
7 changes: 3 additions & 4 deletions tests/test_dependency_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def _setup_gh_pr_response(method, pr_body=""):
{
"title": "Update from package template",
"body": pr_body,
"draft": False,
"base": "master",
"head": "template-sync",
}
Expand Down Expand Up @@ -249,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 @@ -287,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 @@ -324,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