diff --git a/.github/scripts/dapr_bot.js b/.github/scripts/dapr_bot.js index 37b4cdd58..30e0ba016 100644 --- a/.github/scripts/dapr_bot.js +++ b/.github/scripts/dapr_bot.js @@ -94,6 +94,10 @@ async function handleIssueCommentCreate({ github, context }) { case '/ok-to-test': await cmdOkToTest(github, issue, isFromPulls) break + case command.match(/^\/rerun \d+/)?.input: + const workflowrunid = command.match(/\d+/)[0]; + await rerunWorkflow(github, issue, workflowrunid) + break default: console.log( `[handleIssueCommentCreate] command ${command} not found, exiting.` @@ -234,3 +238,18 @@ async function cmdOkToTest(github, issue, isFromPulls) { ) } } + +/** + * Rerun all failed jobs of a given workflow run ID. + * @param {*} github GitHub object reference + * @param {*} issue GitHub issue object + * @param {int} workflowrunid the workflow run ID for which to rerun all failed jobs + */ +async function rerunWorkflow(github, issue, workflowrunid) { + // Rerun all failed jobs of the specified workflow run + const pull = await github.rest.actions.reRunWorkflowFailedJobs({ + owner: issue.owner, + repo: issue.repo, + run_id: workflowrunid, + }); +} \ No newline at end of file