import { enviroment } from '../environments/environment' ; import { GitHubRepositoryWebhookResponse } from '../mappers/github/webhook.mapper' ; import { GitHubClient } from './../client/github' ; export function listWebhook ( repositoryFullName , token ) { return GitHubClient < GitHubRepositoryWebhookResponse [ ] > ( `/repos/${ repositoryFullName }/hooks` , token ) ; } export async function findWebhook ( repositoryFullName , token ) { const list = await listWebhook ( repositoryFullName , token ) ; return list . find ( ( elem ) => elem && elem . config && elem . config . url === enviroment . githubWebhook . url ) ; }