File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7171 return;
7272 }
7373
74- // Pick the merged PR targeting main (most common).
75- const pr = pulls.data.find(p => p.merged_at && p.base?.ref === "main") ?? pulls.data[0];
74+ // Only act on a PR that was actually merged into main.
75+ // If none is found (e.g. backport or same-commit PR from another base),
76+ // bail out rather than falling back to an arbitrary association.
77+ const pr = pulls.data.find(p => p.merged_at && p.base?.ref === "main");
78+ if (!pr) {
79+ core.setOutput("should_release", "false");
80+ core.setOutput("pr_number", "");
81+ core.notice(
82+ `No merged-into-main PR found among ${pulls.data.length} association(s) for commit ${sha}. Not releasing.`
83+ );
84+ return;
85+ }
7686 const labels = (pr.labels || []).map(l => l.name);
7787 core.setOutput("pr_number", String(pr.number));
7888 const should = labels.includes("auto:release");
You can’t perform that action at this time.
0 commit comments