Skip to content

Commit 4b0ccc8

Browse files
committed
ci: fix duplicate SDK-update PRs by matching on branch prefix
The existing-PR check filtered by --author 'app/github-actions', but PRs are created via a GitHub App token (app/reveng-github), so the filter always matched zero PRs and a new one was opened every run. The title substring check was also broken (titles are "Update SDK to version X", not "SDK update X"). Switch to searching open PRs by the sdk-update- branch prefix, which this workflow itself owns.
1 parent 341451c commit 4b0ccc8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/check.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,25 @@ jobs:
5151
return None
5252
5353
def check_existing_prs():
54-
"""Check if there are existing open PRs from the bot"""
54+
"""Check if there are existing open SDK-update PRs.
55+
56+
Matches by branch prefix `sdk-update-`, which this workflow owns.
57+
Author-based filtering is unreliable: PRs are created via a GitHub
58+
App token (app/reveng-github), not the default github-actions bot.
59+
"""
5560
try:
5661
result = subprocess.run([
5762
'gh', 'pr', 'list', '--state', 'open',
58-
'--author', 'app/github-actions', '--json', 'title'
63+
'--search', 'head:sdk-update-',
64+
'--json', 'number,title,headRefName'
5965
], capture_output=True, text=True, check=True)
6066
6167
prs = json.loads(result.stdout)
62-
for pr in prs:
63-
if 'SDK update' in pr.get('title', '') or 'OpenAPI' in pr.get('title', ''):
64-
return True
68+
matching = [pr for pr in prs if pr.get('headRefName', '').startswith('sdk-update-')]
69+
if matching:
70+
for pr in matching:
71+
print(f" - #{pr['number']} {pr['title']} ({pr['headRefName']})")
72+
return True
6573
return False
6674
except Exception as e:
6775
print(f"Error checking existing PRs: {e}")

0 commit comments

Comments
 (0)