Skip to content

Commit

Permalink
fix: hasspecifichook function
Browse files Browse the repository at this point in the history
  • Loading branch information
ElderMatt committed Nov 3, 2023
1 parent 6c0d0c6 commit f5d9d5b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/tasks/gitea/gitea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ async function hasSpecificHook(repoApi: RepositoryApi, hookToFind: string): Prom
() => repoApi.repoListHooks(orgName, 'values'),
400,
)
if (hooks) {
hooks.forEach((hook) => {
if (hook.config && hook.config.url.includes(hookToFind)) {
console.debug(`Hook (${hookToFind}) exists`)
console.debug('HOOK:', hook)
return { id: hook.id, hasHook: true }
}
return { hasHook: false }
})
if (!hooks) return { hasHook: false }
const foundHook = hooks.find((hook) => {
return hook.config && hook.config.url.includes(hookToFind)
})
if (foundHook) {
console.debug(`Hook (${hookToFind}) exists`)
console.debug('HOOK:', foundHook)
return { id: foundHook.id, hasHook: true }
}
return { hasHook: false }
}
Expand Down

0 comments on commit f5d9d5b

Please sign in to comment.