mirror of
https://github.com/outline/outline.git
synced 2026-01-07 11:40:08 -06:00
* wip * Implementation complete * tidying * test * Address feedback * Remove duplicative retry logic from UpdateDocumentsPopularityScoreTask. Now that we're split across many runs this is not neccessary * Refactor to subclass, config to instance * Refactor BaseTask to named export * fix: Missing partition * tsc * Feedback
27 lines
695 B
TypeScript
27 lines
695 B
TypeScript
import { IntegrationService } from "@shared/types";
|
|
import { BaseTask } from "@server/queues/tasks/base/BaseTask";
|
|
import { Hook, PluginManager } from "@server/utils/PluginManager";
|
|
|
|
type Props = {
|
|
headers: Record<string, unknown>;
|
|
payload: Record<string, unknown>;
|
|
};
|
|
|
|
export default class GitHubWebhookTask extends BaseTask<Props> {
|
|
public async perform({ headers, payload }: Props): Promise<void> {
|
|
const plugins = PluginManager.getHooks(Hook.IssueProvider);
|
|
const plugin = plugins.find(
|
|
(p) => p.value.service === IntegrationService.GitHub
|
|
);
|
|
|
|
if (!plugin) {
|
|
return;
|
|
}
|
|
|
|
await plugin.value.handleWebhook({
|
|
headers,
|
|
payload,
|
|
});
|
|
}
|
|
}
|