mirror of https://github.com/renovatebot/renovate
refactor: simplify archived check
parent
a3c938824a
commit
eb2c159d02
lib/platform/github
test/platform/github/__snapshots__
|
@ -88,9 +88,12 @@ async function initRepo(repoName, token, endpoint, forkMode, forkToken) {
|
|||
try {
|
||||
res = await get(`repos/${repoName}`);
|
||||
logger.trace({ repositoryDetails: res.body }, 'Repository details');
|
||||
logger.info('Repository is archived - throwing error to abort renovation');
|
||||
if (res.body.archived) {
|
||||
throw new Error('archived');
|
||||
}
|
||||
platformConfig.privateRepo = res.body.private === true;
|
||||
platformConfig.isFork = res.body.fork === true;
|
||||
platformConfig.isArchived = res.body.archived === true;
|
||||
config.owner = res.body.owner.login;
|
||||
logger.debug(`${repoName} owner = ${config.owner}`);
|
||||
// Use default branch as PR target unless later overridden
|
||||
|
@ -113,9 +116,6 @@ async function initRepo(repoName, token, endpoint, forkMode, forkToken) {
|
|||
logger.info({ err, res }, 'Unknown GitHub initRepo error');
|
||||
throw err;
|
||||
}
|
||||
if (platformConfig.isArchived) {
|
||||
throw new Error('archived');
|
||||
}
|
||||
delete config.issueList;
|
||||
delete config.prList;
|
||||
delete config.fileList;
|
||||
|
|
|
@ -547,7 +547,6 @@ Array [
|
|||
|
||||
exports[`platform/github initRepo should forks when forkMode 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -572,7 +571,6 @@ Array [
|
|||
|
||||
exports[`platform/github initRepo should initialise the config for the repo - 0 2`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -597,7 +595,6 @@ Array [
|
|||
|
||||
exports[`platform/github initRepo should initialise the config for the repo - 1 2`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -622,7 +619,6 @@ Array [
|
|||
|
||||
exports[`platform/github initRepo should initialise the config for the repo - 2 2`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -630,7 +626,6 @@ Object {
|
|||
|
||||
exports[`platform/github initRepo should merge 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -638,7 +633,6 @@ Object {
|
|||
|
||||
exports[`platform/github initRepo should not guess at merge 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -646,7 +640,6 @@ Object {
|
|||
|
||||
exports[`platform/github initRepo should rebase 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -654,7 +647,6 @@ Object {
|
|||
|
||||
exports[`platform/github initRepo should squash 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
@ -662,7 +654,6 @@ Object {
|
|||
|
||||
exports[`platform/github initRepo should update fork when forkMode 1`] = `
|
||||
Object {
|
||||
"isArchived": false,
|
||||
"isFork": false,
|
||||
"privateRepo": false,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue