Skip to content

Commit

Permalink
[github-app] handle repository.renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev authored and roboquat committed Aug 3, 2021
1 parent c937dfd commit 7f0908b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/server/ee/src/prebuilds/github-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ export class GithubApp {
await this.appInstallationDB.recordUninstallation("github", 'platform', installationId);
});

app.on('repository.renamed', async ctx => {
const { action, repository, installation } = ctx.payload;
if (!installation) {
return;
}
if (action === "renamed") {
const project = await this.projectDB.findProjectByInstallationId(String(installation.id))
if (project) {
project.cloneUrl = repository.clone_url;
await this.projectDB.storeProject(project);
}
}
// TODO(at): handle deleted as well
});

app.on('push', async ctx => {
await this.handlePushEvent(ctx);
});
Expand Down

0 comments on commit 7f0908b

Please sign in to comment.