feat: add new branch trigger in GitHub
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
6bee6bafa8
commit
3551d12e7d
23
packages/backend/src/apps/github/data/list-repos.ts
Normal file
23
packages/backend/src/apps/github/data/list-repos.ts
Normal 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,
|
||||
}));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user