mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
refactor(repositoryWorker): Separate token from config
This commit is contained in:
parent
e41c44ea77
commit
4eb20e0e57
3 changed files with 6 additions and 6 deletions
|
@ -17,7 +17,7 @@ async function start() {
|
||||||
for (let index = 0; index < config.repositories.length; index += 1) {
|
for (let index = 0; index < config.repositories.length; index += 1) {
|
||||||
const repoConfig = module.exports.getRepositoryConfig(config, index);
|
const repoConfig = module.exports.getRepositoryConfig(config, index);
|
||||||
repoConfig.logger.info('Renovating repository');
|
repoConfig.logger.info('Renovating repository');
|
||||||
await repositoryWorker.renovateRepository(repoConfig);
|
await repositoryWorker.renovateRepository(repoConfig, repoConfig.token);
|
||||||
repoConfig.logger.info('Finished repository');
|
repoConfig.logger.info('Finished repository');
|
||||||
}
|
}
|
||||||
if (config.repositories.length === 0) {
|
if (config.repositories.length === 0) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ async function setNpmrc(config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initApis(inputConfig) {
|
async function initApis(inputConfig, token) {
|
||||||
function getPlatformApi(platform) {
|
function getPlatformApi(platform) {
|
||||||
if (platform === 'github') {
|
if (platform === 'github') {
|
||||||
return githubApi;
|
return githubApi;
|
||||||
|
@ -42,7 +42,7 @@ async function initApis(inputConfig) {
|
||||||
config.api = getPlatformApi(config.platform);
|
config.api = getPlatformApi(config.platform);
|
||||||
await config.api.initRepo(
|
await config.api.initRepo(
|
||||||
config.repository,
|
config.repository,
|
||||||
config.token,
|
token,
|
||||||
config.endpoint,
|
config.endpoint,
|
||||||
config.logger
|
config.logger
|
||||||
);
|
);
|
||||||
|
|
|
@ -10,13 +10,13 @@ module.exports = {
|
||||||
renovateRepository,
|
renovateRepository,
|
||||||
};
|
};
|
||||||
|
|
||||||
async function renovateRepository(packageFileConfig) {
|
async function renovateRepository(repoConfig, token) {
|
||||||
let config = Object.assign({}, packageFileConfig);
|
let config = Object.assign({}, repoConfig);
|
||||||
config.errors = [];
|
config.errors = [];
|
||||||
config.warnings = [];
|
config.warnings = [];
|
||||||
config.logger.trace({ config }, 'renovateRepository');
|
config.logger.trace({ config }, 'renovateRepository');
|
||||||
try {
|
try {
|
||||||
config = await apis.initApis(config);
|
config = await apis.initApis(config, token);
|
||||||
config = await apis.mergeRenovateJson(config);
|
config = await apis.mergeRenovateJson(config);
|
||||||
if (config.enabled === false) {
|
if (config.enabled === false) {
|
||||||
config.logger.debug('repository is disabled');
|
config.logger.debug('repository is disabled');
|
||||||
|
|
Loading…
Reference in a new issue