Skip to content

Commit 78273ea

Browse files
remove fallback from release flow if not on main
1 parent ba6a7e6 commit 78273ea

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,18 @@ jobs:
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");

0 commit comments

Comments
 (0)