Skip to content

Commit

Permalink
cosmetic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzm committed Jan 22, 2025
1 parent bb63a42 commit c5b10bd
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions scripts/backport.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,29 +354,20 @@ def should_backport_by_labels(number, title, labels):

def branch_has_open_pr(repo, branch):
"""Check whether the given branch has an open PR."""
result = run_query(
string.Template(
"""
query {
repository(name: "$repo_name", owner: "$repo_owner") {
ref(qualifiedName: "$branch") {
associatedPullRequests(first: 1) {
nodes {
closed
}
}
}
}
}
"""
).substitute(
{
"branch": branch,
"repo_name": repo.name,
"repo_owner": repo.owner.login,
}
)
)

template = """query {
repository(name: "$repo_name", owner: "$repo_owner") {
ref(qualifiedName: "$branch") {
associatedPullRequests(first: 1) {
nodes { closed }}}}}"""

params = {
"branch": branch,
"repo_name": repo.name,
"repo_owner": repo.owner.login,
}

result = run_query(string.Template(template).substitute(params))

# This returns:
# {'data': {'repository': {'ref': {'associatedPullRequests': {'nodes': [{'closed': True}]}}}}}
Expand Down

0 comments on commit c5b10bd

Please sign in to comment.