Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lively.git/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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()}`,
Expand Down
2 changes: 2 additions & 0 deletions lively.project/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down