@@ -38,19 +38,39 @@ jobs:
3838 uses : actions/github-script@v7
3939 with :
4040 script : |
41+ const owner = context.repo.owner;
42+ const repo = context.repo.repo;
43+ const headSha = context.payload.pull_request.head.sha;
44+
45+ core.info(`owner: ${owner}`);
46+ core.info(`repo: ${repo}`);
47+ core.info(`head_sha: ${headSha}`);
48+ core.info(`event action: ${context.payload.action}`);
49+ core.info(`label: ${context.payload.label?.name}`);
50+
4151 const runs = await github.rest.actions.listWorkflowRunsForRepo({
42- owner: context.repo.owner ,
43- repo: context.repo.repo ,
52+ owner,
53+ repo,
4454 workflow_id: 'pull-request.yml',
4555 event: 'pull_request',
46- head_sha: context.sha ,
56+ head_sha: headSha ,
4757 status: 'completed',
4858 });
59+
60+ core.info(`total completed runs found: ${runs.data.total_count}`);
61+ for (const r of runs.data.workflow_runs) {
62+ core.info(` run id=${r.id} status=${r.status} conclusion=${r.conclusion} created_at=${r.created_at}`);
63+ }
64+
4965 const run = runs.data.workflow_runs[0];
5066 if (run) {
67+ core.info(`triggering rerun for run id=${run.id}`);
5168 await github.rest.actions.reRunWorkflow({
52- owner: context.repo.owner ,
53- repo: context.repo.repo ,
69+ owner,
70+ repo,
5471 run_id: run.id,
5572 });
73+ core.info('rerun triggered successfully');
74+ } else {
75+ core.warning('no completed pull-request.yml run found for this SHA — skipping rerun');
5676 }
0 commit comments