diff --git a/lib/platform/github/index.js b/lib/platform/github/index.js index c9dc8163f0d3f69cb257e8630eb03bc728c5bb77..dba2a4c54dff30fa2bd3045ef76bf79588b9cfea 100644 --- a/lib/platform/github/index.js +++ b/lib/platform/github/index.js @@ -142,9 +142,6 @@ async function initRepo({ // istanbul ignore if if (process.env.NODE_ENV !== 'test') { getBranchCommit(config.baseBranch); // warm the cache - if (!res.body.permissions.push) { - throw new Error('write-forbidden'); - } } logger.debug(`${repository} default branch = ${config.baseBranch}`); // GitHub allows administrators to block certain types of merge, so we need to check it @@ -172,9 +169,6 @@ async function initRepo({ if (err.message.startsWith('Repository access blocked')) { throw new Error('blocked'); } - if (err.message === 'write-forbidden') { - throw new Error('write-forbidden'); - } logger.info( { err, message: err.message, body: res ? res.body : undefined }, 'Unknown GitHub initRepo error' diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 55355c1c9ac688ba83dbff246be6782cb02cdb3a..2a9520bae5d513c8cccf705a6d9d65d63c21f7c4 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -93,15 +93,6 @@ async function initRepo({ repository, token, endpoint }) { config.defaultBranch = res.body.default_branch; config.baseBranch = config.defaultBranch; logger.debug(`${repository} default branch = ${config.baseBranch}`); - // istanbul ignore if - if (process.env.NODE_ENV !== 'test') { - if ( - !res.body.permissions.project_access || - res.body.permissions.project_access.access_level < 40 - ) { - throw new Error('write-forbidden'); - } - } // Discover our user email config.email = (await get(`user`)).body.email; delete config.prList; diff --git a/lib/workers/repository/error.js b/lib/workers/repository/error.js index a1ff1ebef0412d766842c84f1036466d6e1f9ca5..5f3557cd9dd5d31811c9ef75f9127383be63954a 100644 --- a/lib/workers/repository/error.js +++ b/lib/workers/repository/error.js @@ -28,10 +28,6 @@ async function handleError(config, err) { delete config.branchList; // eslint-disable-line no-param-reassign logger.info('Repository is forbidden'); return err.message; - } else if (err.message === 'write-forbidden') { - delete config.branchList; // eslint-disable-line no-param-reassign - logger.error(`The token doesn't have write permissions to the repository`); - return err.message; } else if (err.message === 'not-found') { delete config.branchList; // eslint-disable-line no-param-reassign logger.error('Repository is not found'); diff --git a/test/workers/repository/error.spec.js b/test/workers/repository/error.spec.js index 4db1659a4d25e21cc34eece0c3fb19de3741f389..992c3c4e9b42148f27a7657b33f2183af24bed88 100644 --- a/test/workers/repository/error.spec.js +++ b/test/workers/repository/error.spec.js @@ -23,7 +23,6 @@ describe('workers/repository/error', () => { 'blocked', 'not-found', 'forbidden', - 'write-forbidden', 'rate-limit-exceeded', ]; errors.forEach(err => {