mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
d198ccdcf7
Add `findGithubComHostRule()` and `findGithubComToken()` to `lib/util/check-token.ts`, backed by a new exported `GITHUB_API_URL` constant, and use them at every site that looked up the `github` host rule for `https://api.github.com/` by hand: `nix`, `mise` and `composer` artifacts, `github-actions` artifacts (`getTokenEnv`'s github.com branch; the GitHub Enterprise Server branch keeps its own generic `findToken(url)` helper unchanged), `npm` post-update, and `lib/util/git/auth.ts`. No behaviour change: - Sites that only needed the normalized token (nix, mise, github-actions) now call `findGithubComToken()`. - Sites that need the full host rule (composer, npm post-update, git/auth) now call `findGithubComHostRule()`, preserving their existing use of the raw `token` field or `isArtifactAuthEnabled()` checks. - `checkGithubToken()` in the same file keeps its own `hostRules.find({ hostType: 'github', url: 'https://api.github.com' })` call (note: no trailing slash) untouched, since it isn't one of the duplicated call sites and switching it to the new constant would change the matched URL. Covered by new `findGithubComHostRule`/`findGithubComToken` spec cases in `lib/util/check-token.spec.ts`. No other spec needed changes: all affected callers' specs configure host rules through the real `hostRules.add()` rather than mocking the lookup.