Skip to content

Commit 11adf9e

Browse files
committed
feat: modified fall back to check open pr
2 parents 01517fc + 799878a commit 11adf9e

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

.github/workflows/export_cloud_build_logs.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,34 @@ jobs:
4747
'langchain-python-sdk-pr-',
4848
'llamaindex-python-sdk-pr-',
4949
];
50-
let pr_number = undefined;
50+
let pr_number = undefined;
5151
const { owner, repo } = context.repo;
5252
const sha = context.payload.check_suite.head_sha;
5353
if (context.payload.check_suite && context.payload.check_suite.pull_requests && context.payload.check_suite.pull_requests.length > 0) {
5454
pr_number = context.payload.check_suite.pull_requests[0].number;
5555
}
56+
//paginate through all open PRs to find matching head SHA
5657
if (!pr_number) {
57-
const { data: prs } = await github.rest.pulls.list({
58-
owner,
59-
repo,
60-
state: 'open',
61-
per_page: 100
62-
});
63-
const match = prs.find(pr => pr.head && pr.head.sha === sha);
64-
if (match) {
65-
pr_number = match.number;
58+
let page = 1;
59+
let found = false;
60+
while (!found) {
61+
const { data: prs } = await github.rest.pulls.list({
62+
owner,
63+
repo,
64+
state: 'open',
65+
per_page: 100,
66+
page
67+
});
68+
if (!prs || prs.length === 0) {
69+
break;
70+
}
71+
const match = prs.find(pr => pr.head && pr.head.sha === sha);
72+
if (match) {
73+
pr_number = match.number;
74+
found = true;
75+
} else {
76+
page++;
77+
}
6678
}
6779
}
6880
if (!pr_number) {

0 commit comments

Comments
 (0)