Skip to content

Commit 4a62c41

Browse files
committed
Improve logic
1 parent a9e4f14 commit 4a62c41

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

action.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ exports.action = async function action() {
9898

9999
async function actionIssue() {
100100
console.info(`Calling action on issue`);
101+
console.log(github.context);
102+
return;
101103
const { owner, repo, issueNumber, pullRequest } = await getActionParameters();
102104

103105
const workflowRuns = await octokit.paginate(
@@ -124,12 +126,18 @@ async function actionIssue() {
124126
? 1
125127
: 0
126128
);
127-
console.log(
128-
"DEBUG SORTED RUNS",
129-
reviewWorkflows.map(({ run_started_at }) => run_started_at)
130-
);
131129
const latestRun = reviewWorkflows[0];
132-
console.log("DEBUG LATEST RUN", latestRun);
130+
const { id: runId } = latestRun;
131+
console.log(`Triggering re-run on ${runId}`);
132+
133+
await octokit.request(
134+
"POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun",
135+
{
136+
owner,
137+
repo,
138+
run_id: runId,
139+
}
140+
);
133141
}
134142

135143
async function actionPullRequest() {

0 commit comments

Comments
 (0)