Skip to content

Commit f357b0b

Browse files
committed
remove unneeded code
1 parent 78ca21f commit f357b0b

1 file changed

Lines changed: 3 additions & 29 deletions

File tree

src/index.ts

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,10 @@ const octokit = new Octokit();
66
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split("/")!;
77
const pull_request_number = parseInt(process.env.GITHUB_REF?.split("/")[2]!);
88
const compilation_output = readFileSync("compilation.log");
9-
const { data: pullRequest } = await octokit.rest.pulls.get({
10-
owner,
11-
repo,
12-
pull_number: pull_request_number,
13-
});
149

15-
const { data: actions } = await octokit.rest.actions.listWorkflowRunsForRepo({
10+
octokit.rest.issues.createComment({
1611
owner,
1712
repo,
13+
issue_number: pull_request_number,
14+
body: `compilation output is:\n\n\`\`\`\n${compilation_output}\n\`\`\``,
1815
});
19-
20-
const workflow_runs = actions.workflow_runs.filter(
21-
(action) =>
22-
action.head_branch === pullRequest.head.ref && action.status === "completed"
23-
);
24-
25-
if (workflow_runs.length === 0) {
26-
console.log("No workflow runs found for this pull request.");
27-
} else {
28-
const latest = workflow_runs.reduce((latest, action) => {
29-
if (!latest) return action;
30-
return new Date(action.created_at) > new Date(latest.created_at)
31-
? action
32-
: latest;
33-
});
34-
35-
octokit.rest.issues.createComment({
36-
owner,
37-
repo,
38-
issue_number: pull_request_number,
39-
body: `The latest workflow run for this pull request is [#${latest.run_number}](${latest.html_url}), and the compilation output is:\n\n\`\`\`\n${compilation_output}\n\`\`\``,
40-
});
41-
}

0 commit comments

Comments
 (0)