@@ -18,10 +18,16 @@ inputs:
1818 required : false
1919 default : ' true'
2020
21+ outputs :
22+ triggered :
23+ description : ' Whether a rerun was actually triggered (true/false)'
24+ value : ${{ steps.rerun.outputs.triggered }}
25+
2126runs :
2227 using : composite
2328 steps :
2429 - name : Rerun job(s)
30+ id : rerun
2531 uses : actions/github-script@v7
2632 with :
2733 github-token : ${{ inputs.token }}
@@ -44,12 +50,14 @@ runs:
4450 );
4551 if (activeRun) {
4652 core.info(`Workflow run ${activeRun.id} is already ${activeRun.status}, skipping rerun.`);
53+ core.setOutput('triggered', 'false');
4754 return;
4855 }
4956
5057 const completedRun = workflow_runs.find(r => r.status === 'completed');
5158 if (!completedRun) {
5259 core.warning('No workflow runs found for the current HEAD SHA.');
60+ core.setOutput('triggered', 'false');
5361 return;
5462 }
5563
@@ -61,10 +69,12 @@ runs:
6169 const job = jobs.find(j => j.name === jobName);
6270 if (!job) {
6371 core.setFailed(`Job "${jobName}" not found in run ${completedRun.id}. Available: ${jobs.map(j => j.name).join(', ')}`);
72+ core.setOutput('triggered', 'false');
6473 return;
6574 }
6675 core.info(`Rerunning job "${job.name}" (id: ${job.id}) from run ${completedRun.id}`);
6776 await github.rest.actions.reRunJobForWorkflowRun({ owner, repo, job_id: job.id });
77+ core.setOutput('triggered', 'true');
6878 return;
6979 }
7080
7686 core.info(`Rerunning all jobs for run ${completedRun.id} (conclusion: ${completedRun.conclusion})`);
7787 await github.rest.actions.reRunWorkflow({ owner, repo, run_id: completedRun.id });
7888 }
89+ core.setOutput('triggered', 'true');
0 commit comments