diff --git a/lively.git/index.js b/lively.git/index.js index 552adf2409..24f40c6e9e 100644 --- a/lively.git/index.js +++ b/lively.git/index.js @@ -97,7 +97,6 @@ export class GitHubAPIWrapper { } static async deleteDeployKey (repoOwner, repoName, title) { - // TODO: If this is called with a non-existing key bad things happen! const resKeyList = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/keys`, { method: 'GET', headers: { @@ -106,9 +105,13 @@ export class GitHubAPIWrapper { } }); const deployKeys = await resKeyList.json(); + + // Should allow us to catch all cases where no keys are found in which case we do not have to delete anythings + if (!deployKeys.find) return; + const keyIdToRemove = deployKeys.find(key => key.title === title).id; - const resKeyDeletion = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/keys/${keyIdToRemove}`, { + await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/keys/${keyIdToRemove}`, { method: 'DELETE', headers: { Authorization: `Bearer ${currentUserToken()}`, diff --git a/lively.project/project.js b/lively.project/project.js index c765c6d6b0..e6c6767ce4 100644 --- a/lively.project/project.js +++ b/lively.project/project.js @@ -469,6 +469,8 @@ export class Project { for (let i = 0; i < dependencies.length; i++) { const dep = dependencies[i]; + if (!dep.privateRepo) continue; + const normalizedDep = normalizedDeps[i]; if (alreadySetupDependencies.includes(normalizedDep)) continue; const [priv, pub] = await generateKeyPair();