fix(release): point repository URLs at renamed GitHub repo (#250)

* fix(release): point repository URLs at renamed GitHub repo

The GitHub repo was renamed from Kaelio/ktx to
Kaelio/ktx-ai-data-agents-context. semantic-release reads repositoryUrl
from package.json's repository field and the @semantic-release/github
plugin failed verifyConditions with EMISMATCHGITHUBURL because it no
longer matched the live clone URL.

Update every Kaelio/ktx reference to the renamed repo: package metadata
(root + CLI repository/bugs/homepage), the codecov upload slugs and
star-history slug in CI, the issue-template and security-advisory links,
the release runbook, and all docs/install commands.

* fix(release): derive semantic-release repositoryUrl from the CI repo

@semantic-release/github exact-matches repositoryUrl against the live
GitHub clone_url (no redirect following), so any repo rename re-breaks the
release when repositoryUrl is the static package.json value.

Derive repositoryUrl from the runner's GITHUB_REPOSITORY/GITHUB_SERVER_URL
so it always tracks the current repo name. A future rename (including back
to Kaelio/ktx) now resolves with no code change. Outside CI the option is
omitted, so semantic-release falls back to package.json as documented.

The package.json repository field stays ktx-ai-data-agents-context as
npm-display metadata, decoupled from the release-time match.
This commit is contained in:
Andrey Avtomonov 2026-06-01 20:07:24 +02:00 committed by GitHub
parent 9133d243e8
commit 41f52797de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 94 additions and 33 deletions

View file

@ -104,6 +104,22 @@ function releaseTag(kind, env = process.env) {
return `branch-${branchPrereleaseId(branchName)}`;
}
function repositoryUrl(env = process.env) {
// @semantic-release/github compares this URL's owner/repo against the live
// GitHub clone_url with an exact match (no redirect following), so a repo
// rename breaks the release unless repositoryUrl tracks the *current* name.
// In CI, derive it from the runner's repository so renames never re-break the
// release. Outside CI, return undefined so semantic-release falls back to the
// package.json `repository` field (its documented default).
const repository = env.GITHUB_REPOSITORY;
if (!repository) {
return undefined;
}
const server = env.GITHUB_SERVER_URL || 'https://github.com';
return `${server}/${repository}.git`;
}
function releaseBranches(env = process.env) {
const kind = releaseKind(env);
@ -127,10 +143,12 @@ function releaseBranches(env = process.env) {
function createReleaseConfig(env = process.env) {
const kind = releaseKind(env);
const tag = releaseTag(kind, env);
const url = repositoryUrl(env);
return {
tagFormat: 'v${version}',
branches: releaseBranches(env),
...(url ? { repositoryUrl: url } : {}),
plugins: [
[
'@semantic-release/commit-analyzer',
@ -203,4 +221,5 @@ module.exports = {
releaseBranches,
releaseKind,
releaseTag,
repositoryUrl,
};

View file

@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
import { describe, it } from 'node:test';
const require = createRequire(import.meta.url);
const { createReleaseConfig, releaseBranches, releaseKind, releaseTag } = require('./semantic-release-config.cjs');
const { createReleaseConfig, releaseBranches, releaseKind, releaseTag, repositoryUrl } = require('./semantic-release-config.cjs');
function prepareExecOptions(config) {
return config.plugins.find((plugin) => Array.isArray(plugin) && plugin[0] === '@semantic-release/exec' && plugin[1].prepareCmd)[1];
@ -141,6 +141,38 @@ describe('semantic-release config', () => {
assert.match(analyzeExec[1].analyzeCommitsCmd, /FORCE_RELEASE === 'true' \? 'patch' : ''/);
});
it('pins repositoryUrl to the runner repository so a GitHub rename never re-breaks the release', () => {
// @semantic-release/github exact-matches repositoryUrl against the live
// clone_url, so the release must track the *current* repo name, not the
// static package.json value.
assert.equal(
repositoryUrl({ GITHUB_REPOSITORY: 'Kaelio/ktx-ai-data-agents-context' }),
'https://github.com/Kaelio/ktx-ai-data-agents-context.git',
);
assert.equal(
repositoryUrl({ GITHUB_REPOSITORY: 'Kaelio/ktx' }),
'https://github.com/Kaelio/ktx.git',
'a later rename back to Kaelio/ktx must resolve without any code change',
);
assert.equal(
repositoryUrl({ GITHUB_REPOSITORY: 'Kaelio/ktx', GITHUB_SERVER_URL: 'https://ghe.example.com' }),
'https://ghe.example.com/Kaelio/ktx.git',
);
const config = createReleaseConfig({
KTX_RELEASE_KIND: 'stable',
GITHUB_REF_NAME: 'main',
GITHUB_REPOSITORY: 'Kaelio/ktx-ai-data-agents-context',
});
assert.equal(config.repositoryUrl, 'https://github.com/Kaelio/ktx-ai-data-agents-context.git');
});
it('omits repositoryUrl outside CI so semantic-release falls back to package.json', () => {
assert.equal(repositoryUrl({}), undefined);
const config = createReleaseConfig({ KTX_RELEASE_KIND: 'stable', GITHUB_REF_NAME: 'main' });
assert.equal('repositoryUrl' in config, false);
});
it('does not configure any commit type to create an automatic major release', () => {
const config = createReleaseConfig({ KTX_RELEASE_KIND: 'stable', GITHUB_REF_NAME: 'main' });
const analyzer = config.plugins.find(