Skip to content

Commit

Permalink
[bot][ez] Fix cancel workflows on close (#4724)
Browse files Browse the repository at this point in the history
I thought the data would be returned in the form of { total_count: idk,
workflow_runs: [list]} and that I had to unwrap it myself, but
apparently it is already unwrapped into a list.
  • Loading branch information
clee2000 authored Nov 10, 2023
1 parent b996448 commit f7ed2ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions torchci/lib/bot/cancelWorkflowsOnCloseBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ function cancelWorkflowsOnCloseBot(app: Probot): void {
repo,
head_sha: headSha,
per_page: 30,
},
(o) => o.data.workflow_runs
}
);

await Promise.all(
Expand Down
12 changes: 5 additions & 7 deletions torchci/test/cancelWorkflowsOnCloseBot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ describe("accept bot", () => {
.get(
"/repos/clee2000/random-testing/actions/runs?head_sha=381ace654ad6474357cedad09418340896d16d90&per_page=30"
)
.reply(200, {
workflow_runs: [
{ id: 6647495490, status: "in_progress" },
{ id: 6647495495, status: "in_progress" },
{ id: 6647495497, status: "completed" },
],
})
.reply(200, [
{ id: 6647495490, status: "in_progress" },
{ id: 6647495495, status: "in_progress" },
{ id: 6647495497, status: "completed" },
])
.post(`/repos/clee2000/random-testing/actions/runs/6647495490/cancel`)
.reply(200, {})
.post(`/repos/clee2000/random-testing/actions/runs/6647495495/cancel`)
Expand Down

1 comment on commit f7ed2ba

@vercel
Copy link

@vercel vercel bot commented on f7ed2ba Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.