feat: add new branch trigger in GitHub

This commit is contained in:
Ali BARIN
2022-04-20 21:56:01 +02:00
committed by Ömer Faruk Aydın
parent 6bee6bafa8
commit 3551d12e7d
7 changed files with 124 additions and 15 deletions

View File

@@ -0,0 +1,23 @@
import { Octokit } from 'octokit';
import type { IJSONObject } from '@automatisch/types';
export default class ListRepos {
client?: Octokit;
constructor(connectionData: IJSONObject) {
if (connectionData.accessToken) {
this.client = new Octokit({
auth: connectionData.accessToken as string,
});
}
}
async run() {
const repos = await this.client.paginate(this.client.rest.repos.listForAuthenticatedUser);
return repos.map((repo) => ({
value: repo.full_name,
name: repo.full_name,
}));
}
}