mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-25 23:11:31 +00:00
fix(github): make automatic hostRules opt-in experimental (#25361)
This commit is contained in:
@@ -31,37 +31,6 @@ exports[`modules/platform/github/index initPlatform() should support default end
|
||||
{
|
||||
"endpoint": "https://api.github.com/",
|
||||
"gitAuthor": undefined,
|
||||
"hostRules": [
|
||||
{
|
||||
"hostType": "docker",
|
||||
"matchHost": "ghcr.io",
|
||||
"password": "123test",
|
||||
"username": "USERNAME",
|
||||
},
|
||||
{
|
||||
"hostType": "npm",
|
||||
"matchHost": "npm.pkg.github.com",
|
||||
"token": "123test",
|
||||
},
|
||||
{
|
||||
"hostType": "rubygems",
|
||||
"matchHost": "rubygems.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "maven",
|
||||
"matchHost": "maven.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "nuget",
|
||||
"matchHost": "nuget.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
],
|
||||
"renovateUsername": "renovate-bot",
|
||||
"token": "123test",
|
||||
}
|
||||
@@ -71,37 +40,6 @@ exports[`modules/platform/github/index initPlatform() should support default end
|
||||
{
|
||||
"endpoint": "https://api.github.com/",
|
||||
"gitAuthor": undefined,
|
||||
"hostRules": [
|
||||
{
|
||||
"hostType": "docker",
|
||||
"matchHost": "ghcr.io",
|
||||
"password": "123test",
|
||||
"username": "USERNAME",
|
||||
},
|
||||
{
|
||||
"hostType": "npm",
|
||||
"matchHost": "npm.pkg.github.com",
|
||||
"token": "123test",
|
||||
},
|
||||
{
|
||||
"hostType": "rubygems",
|
||||
"matchHost": "rubygems.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "maven",
|
||||
"matchHost": "maven.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "nuget",
|
||||
"matchHost": "nuget.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
],
|
||||
"renovateUsername": "renovate-bot",
|
||||
"token": "123test",
|
||||
}
|
||||
@@ -111,37 +49,6 @@ exports[`modules/platform/github/index initPlatform() should support default end
|
||||
{
|
||||
"endpoint": "https://api.github.com/",
|
||||
"gitAuthor": "undefined <user@domain.com>",
|
||||
"hostRules": [
|
||||
{
|
||||
"hostType": "docker",
|
||||
"matchHost": "ghcr.io",
|
||||
"password": "123test",
|
||||
"username": "USERNAME",
|
||||
},
|
||||
{
|
||||
"hostType": "npm",
|
||||
"matchHost": "npm.pkg.github.com",
|
||||
"token": "123test",
|
||||
},
|
||||
{
|
||||
"hostType": "rubygems",
|
||||
"matchHost": "rubygems.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "maven",
|
||||
"matchHost": "maven.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "nuget",
|
||||
"matchHost": "nuget.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
],
|
||||
"renovateUsername": "renovate-bot",
|
||||
"token": "123test",
|
||||
}
|
||||
@@ -151,37 +58,6 @@ exports[`modules/platform/github/index initPlatform() should support gitAuthor a
|
||||
{
|
||||
"endpoint": "https://api.github.com/",
|
||||
"gitAuthor": "renovate@whitesourcesoftware.com",
|
||||
"hostRules": [
|
||||
{
|
||||
"hostType": "docker",
|
||||
"matchHost": "ghcr.io",
|
||||
"password": "123test",
|
||||
"username": "USERNAME",
|
||||
},
|
||||
{
|
||||
"hostType": "npm",
|
||||
"matchHost": "npm.pkg.github.com",
|
||||
"token": "123test",
|
||||
},
|
||||
{
|
||||
"hostType": "rubygems",
|
||||
"matchHost": "rubygems.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "maven",
|
||||
"matchHost": "maven.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
{
|
||||
"hostType": "nuget",
|
||||
"matchHost": "nuget.pkg.github.com",
|
||||
"password": "123test",
|
||||
"username": "renovate-bot",
|
||||
},
|
||||
],
|
||||
"renovateUsername": "renovate-bot",
|
||||
"token": "123test",
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ describe('modules/platform/github/index', () => {
|
||||
|
||||
const repoCache = repository.getCache();
|
||||
delete repoCache.platform;
|
||||
delete process.env.RENOVATE_X_GITHUB_HOST_RULES;
|
||||
});
|
||||
|
||||
describe('initPlatform()', () => {
|
||||
@@ -162,6 +163,7 @@ describe('modules/platform/github/index', () => {
|
||||
});
|
||||
|
||||
it('should autodetect email/user on default endpoint with GitHub App', async () => {
|
||||
process.env.RENOVATE_X_GITHUB_HOST_RULES = 'true';
|
||||
httpMock
|
||||
.scope(githubApiHost, {
|
||||
reqheaders: {
|
||||
|
||||
@@ -204,7 +204,10 @@ export async function initPlatform({
|
||||
renovateUsername,
|
||||
token,
|
||||
};
|
||||
if (platformResult.endpoint === 'https://api.github.com/') {
|
||||
if (
|
||||
process.env.RENOVATE_X_GITHUB_HOST_RULES &&
|
||||
platformResult.endpoint === 'https://api.github.com/'
|
||||
) {
|
||||
logger.debug('Adding GitHub token as GHCR password');
|
||||
platformResult.hostRules = [
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ A way to get the user id of a GitHub app is to [query the user API](https://docs
|
||||
|
||||
## Package Registry Credentials
|
||||
|
||||
When Renovate runs against repositories on `github.com`, it automatically provisions `hostRules` for these GitHub Packages registries using the platform token:
|
||||
When Renovate runs against repositories on `github.com`, and the environment variable `RENOVATE_X_GITHUB_HOST_RULES` is set, then Renovate automatically provisions `hostRules` for these GitHub Packages registries using the platform token:
|
||||
|
||||
- `ghcr.io`
|
||||
- `maven.pkg.github.com`
|
||||
@@ -95,6 +95,9 @@ When Renovate runs against repositories on `github.com`, it automatically provis
|
||||
- `nuget.pkg.github.com`
|
||||
- `rubygems.pkg.github.com`
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
!!! warning Users have reported that this feature is not working correctly, so it has been reverted to experimental mode.
|
||||
|
||||
## Features awaiting implementation
|
||||
|
||||
- The `automergeStrategy` configuration option has not been implemented for this platform, and all values behave as if the value `auto` was used. Renovate will use the merge strategy configured in the GitHub repository itself, and this cannot be overridden yet
|
||||
|
||||
@@ -11,6 +11,7 @@ jest.unmock('./scm');
|
||||
describe('modules/platform/index', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
process.env.RENOVATE_X_GITHUB_HOST_RULES = 'true';
|
||||
});
|
||||
|
||||
it('validates', () => {
|
||||
|
||||
Reference in New Issue
Block a user