mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-04 10:52:13 +02:00
fix(release): don't throw on non-main branches at config-load time
knip loads .releaserc.cjs on every PR run, where GITHUB_REF_NAME is the merge ref (e.g. 180/merge). The previous version of releaseBranches threw immediately when the branch wasn't main, which made knip fail to evaluate the config and then mis-flag @semantic-release/exec as an unused dep. semantic-release already refuses to publish when the current branch doesn't match a configured release branch, so the explicit throw was redundant. Drop it (and the unused currentBranch helper) and replace the "rejects releases from non-main" assertion with one that exercises a CI- shaped GITHUB_REF_NAME and confirms the config loads.
This commit is contained in:
parent
66b674f73a
commit
288b700eb4
2 changed files with 6 additions and 14 deletions
|
|
@ -74,10 +74,6 @@ const releaseNoteTypes = [
|
|||
{ type: 'major', section: 'BREAKING CHANGES', hidden: false },
|
||||
];
|
||||
|
||||
function currentBranch(env) {
|
||||
return env.GITHUB_REF_NAME || env.INPUT_BRANCH || 'main';
|
||||
}
|
||||
|
||||
function releaseKind(env) {
|
||||
return env.KTX_RELEASE_KIND || env.INPUT_RELEASE_KIND || 'rc';
|
||||
}
|
||||
|
|
@ -87,13 +83,8 @@ function releaseTag(kind) {
|
|||
}
|
||||
|
||||
function releaseBranches(env = process.env) {
|
||||
const branch = currentBranch(env);
|
||||
const kind = releaseKind(env);
|
||||
|
||||
if (branch !== 'main') {
|
||||
throw new Error(`KTX releases must run from main, got ${branch}`);
|
||||
}
|
||||
|
||||
if (kind === 'rc') {
|
||||
return [{ name: 'main', prerelease: 'rc', channel: 'next' }];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue