Skip to content

Commit 2d86e85

Browse files
authored
Merge pull request #87 from Ganga4060/testing-f
feat: upsdated workflow
2 parents 5a7fe9f + 6dcee76 commit 2d86e85

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

.github/workflows/export_cloud_build_logs.yml

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,46 +47,33 @@ jobs:
4747
'langchain-python-sdk-pr-',
4848
'llamaindex-python-sdk-pr-',
4949
];
50-
let pr_number = undefined;
51-
const { owner, repo } = context.repo;
52-
const sha = context.payload.check_suite.head_sha;
53-
if (context.payload.check_suite && context.payload.check_suite.pull_requests && context.payload.check_suite.pull_requests.length > 0) {
54-
pr_number = context.payload.check_suite.pull_requests[0].number;
55-
}
56-
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;
66-
}
67-
}
68-
if (!pr_number) {
69-
core.info('No PR found for this check suite or commit. Skipping.');
70-
core.setOutput('failure_detected', 'false');
71-
return;
72-
}
73-
core.setOutput('pr_number', pr_number.toString());
74-
const { data: checks } = await github.rest.checks.listForRef({ owner, repo, ref: sha, per_page: 100 });
50+
const prList = context.payload.check_suite.pull_requests;
51+
if (!prList || prList.length === 0) {
52+
core.info('No PR found for this check suite. Skipping.');
53+
core.setOutput('failure_detected', 'false');
54+
return;
55+
}
56+
const pr_number = prList[0].number;
57+
core.setOutput('pr_number', pr_number.toString());
58+
const { owner, repo } = context.repo;
59+
const sha = context.payload.check_suite.head_sha;
60+
const { data: checks } = await github.rest.checks.listForRef({ owner, repo, ref: sha, per_page: 100 });
7561
const failed = checks.check_runs.filter(
76-
c =>
62+
c =>
7763
prefixes.some(prefix => c.name.startsWith(prefix)) &&
7864
c.status === 'completed' &&
7965
c.conclusion === 'failure'
8066
);
8167
if (failed.length === 0) {
82-
core.info('No failed Cloud Build checks detected.');
83-
core.setOutput('failure_detected', 'false');
84-
return;
68+
core.info('No failed Cloud Build checks detected.');
69+
core.setOutput('failure_detected', 'false');
70+
return;
8571
}
8672
core.info(`Detected ${failed.length} failed build(s).`);
8773
core.setOutput('failure_detected', 'true');
8874
core.setOutput('failed_checks', JSON.stringify(failed.map(f => ({ name: f.name, id: f.id, html_url: f.html_url, details_url: f.details_url, external_id: f.external_id || '' }))));
89-
75+
76+
9077
process-failed-builds:
9178
needs: detect-build-failure
9279
if: needs.detect-build-failure.outputs.failure_detected == 'true'

0 commit comments

Comments
 (0)