@octokit/webhooks

  • Version 9.15.0
  • Published
  • 191 kB
  • 4 dependencies
  • MIT license

Install

npm i @octokit/webhooks
yarn add @octokit/webhooks
pnpm add @octokit/webhooks

Overview

GitHub webhook events toolset for Node.js

Index

Variables

variable emitterEventNames

const emitterEventNames: readonly [
'branch_protection_rule',
'branch_protection_rule.created',
'branch_protection_rule.deleted',
'branch_protection_rule.edited',
'check_run',
'check_run.completed',
'check_run.created',
'check_run.requested_action',
'check_run.rerequested',
'check_suite',
'check_suite.completed',
'check_suite.requested',
'check_suite.rerequested',
'code_scanning_alert',
'code_scanning_alert.appeared_in_branch',
'code_scanning_alert.closed_by_user',
'code_scanning_alert.created',
'code_scanning_alert.fixed',
'code_scanning_alert.reopened',
'code_scanning_alert.reopened_by_user',
'commit_comment',
'commit_comment.created',
'content_reference',
'content_reference.created',
'create',
'delete',
'deploy_key',
'deploy_key.created',
'deploy_key.deleted',
'deployment',
'deployment.created',
'deployment_status',
'deployment_status.created',
'discussion',
'discussion.answered',
'discussion.category_changed',
'discussion.created',
'discussion.deleted',
'discussion.edited',
'discussion.labeled',
'discussion.locked',
'discussion.pinned',
'discussion.transferred',
'discussion.unanswered',
'discussion.unlabeled',
'discussion.unlocked',
'discussion.unpinned',
'discussion_comment',
'discussion_comment.created',
'discussion_comment.deleted',
'discussion_comment.edited',
'fork',
'github_app_authorization',
'github_app_authorization.revoked',
'gollum',
'installation',
'installation.created',
'installation.deleted',
'installation.new_permissions_accepted',
'installation.suspend',
'installation.unsuspend',
'installation_repositories',
'installation_repositories.added',
'installation_repositories.removed',
'issue_comment',
'issue_comment.created',
'issue_comment.deleted',
'issue_comment.edited',
'issues',
'issues.assigned',
'issues.closed',
'issues.deleted',
'issues.demilestoned',
'issues.edited',
'issues.labeled',
'issues.locked',
'issues.milestoned',
'issues.opened',
'issues.pinned',
'issues.reopened',
'issues.transferred',
'issues.unassigned',
'issues.unlabeled',
'issues.unlocked',
'issues.unpinned',
'label',
'label.created',
'label.deleted',
'label.edited',
'marketplace_purchase',
'marketplace_purchase.cancelled',
'marketplace_purchase.changed',
'marketplace_purchase.pending_change',
'marketplace_purchase.pending_change_cancelled',
'marketplace_purchase.purchased',
'member',
'member.added',
'member.edited',
'member.removed',
'membership',
'membership.added',
'membership.removed',
'meta',
'meta.deleted',
'milestone',
'milestone.closed',
'milestone.created',
'milestone.deleted',
'milestone.edited',
'milestone.opened',
'org_block',
'org_block.blocked',
'org_block.unblocked',
'organization',
'organization.deleted',
'organization.member_added',
'organization.member_invited',
'organization.member_removed',
'organization.renamed',
'package',
'package.published',
'package.updated',
'page_build',
'ping',
'project',
'project.closed',
'project.created',
'project.deleted',
'project.edited',
'project.reopened',
'project_card',
'project_card.converted',
'project_card.created',
'project_card.deleted',
'project_card.edited',
'project_card.moved',
'project_column',
'project_column.created',
'project_column.deleted',
'project_column.edited',
'project_column.moved',
'public',
'pull_request',
'pull_request.assigned',
'pull_request.auto_merge_disabled',
'pull_request.auto_merge_enabled',
'pull_request.closed',
'pull_request.converted_to_draft',
'pull_request.edited',
'pull_request.labeled',
'pull_request.locked',
'pull_request.opened',
'pull_request.ready_for_review',
'pull_request.reopened',
'pull_request.review_request_removed',
'pull_request.review_requested',
'pull_request.synchronize',
'pull_request.unassigned',
'pull_request.unlabeled',
'pull_request.unlocked',
'pull_request_review',
'pull_request_review.dismissed',
'pull_request_review.edited',
'pull_request_review.submitted',
'pull_request_review_comment',
'pull_request_review_comment.created',
'pull_request_review_comment.deleted',
'pull_request_review_comment.edited',
'push',
'release',
'release.created',
'release.deleted',
'release.edited',
'release.prereleased',
'release.published',
'release.released',
'release.unpublished',
'repository',
'repository.archived',
'repository.created',
'repository.deleted',
'repository.edited',
'repository.privatized',
'repository.publicized',
'repository.renamed',
'repository.transferred',
'repository.unarchived',
'repository_dispatch',
'repository_dispatch.on-demand-test',
'repository_import',
'repository_vulnerability_alert',
'repository_vulnerability_alert.create',
'repository_vulnerability_alert.dismiss',
'repository_vulnerability_alert.resolve',
'secret_scanning_alert',
'secret_scanning_alert.created',
'secret_scanning_alert.reopened',
'secret_scanning_alert.resolved',
'security_advisory',
'security_advisory.performed',
'security_advisory.published',
'security_advisory.updated',
'security_advisory.withdrawn',
'sponsorship',
'sponsorship.cancelled',
'sponsorship.created',
'sponsorship.edited',
'sponsorship.pending_cancellation',
'sponsorship.pending_tier_change',
'sponsorship.tier_changed',
'star',
'star.created',
'star.deleted',
'status',
'team',
'team.added_to_repository',
'team.created',
'team.deleted',
'team.edited',
'team.removed_from_repository',
'team_add',
'watch',
'watch.started',
'workflow_dispatch',
'workflow_job',
'workflow_job.completed',
'workflow_job.queued',
'workflow_job.started',
'workflow_run',
'workflow_run.completed',
'workflow_run.requested'
];

    Functions

    function createEventHandler

    createEventHandler: <TTransformed>(
    options: Options<TTransformed>
    ) => EventHandler<TTransformed>;

      function createNodeMiddleware

      createNodeMiddleware: (
      webhooks: Webhooks,
      { path, onUnhandledRequest, log }?: MiddlewareOptions
      ) => (request: any, response: any, next?: Function | undefined) => Promise<any>;

        Classes

        class Webhooks

        class Webhooks<TTransformed = unknown> {}

          constructor

          constructor(options: Options<TTransformed> & { secret: string });

            property on

            on: <
            E extends
            | 'branch_protection_rule'
            | 'branch_protection_rule.created'
            | 'branch_protection_rule.deleted'
            | 'branch_protection_rule.edited'
            | 'check_run'
            | 'check_run.completed'
            | 'check_run.created'
            | 'check_run.requested_action'
            | 'check_run.rerequested'
            | 'check_suite'
            | 'check_suite.completed'
            | 'check_suite.requested'
            | 'check_suite.rerequested'
            | 'code_scanning_alert'
            | 'code_scanning_alert.appeared_in_branch'
            | 'code_scanning_alert.closed_by_user'
            | 'code_scanning_alert.created'
            | 'code_scanning_alert.fixed'
            | 'code_scanning_alert.reopened'
            | 'code_scanning_alert.reopened_by_user'
            | 'commit_comment'
            | 'commit_comment.created'
            | 'content_reference'
            | 'content_reference.created'
            | 'create'
            | 'delete'
            | 'deploy_key'
            | 'deploy_key.created'
            | 'deploy_key.deleted'
            | 'deployment'
            | 'deployment.created'
            | 'deployment_status'
            | 'deployment_status.created'
            | 'discussion'
            | 'discussion.answered'
            | 'discussion.category_changed'
            | 'discussion.created'
            | 'discussion.deleted'
            | 'discussion.edited'
            | 'discussion.labeled'
            | 'discussion.locked'
            | 'discussion.pinned'
            | 'discussion.transferred'
            | 'discussion.unanswered'
            | 'discussion.unlabeled'
            | 'discussion.unlocked'
            | 'discussion.unpinned'
            | 'discussion_comment'
            | 'discussion_comment.created'
            | 'discussion_comment.deleted'
            | 'discussion_comment.edited'
            | 'fork'
            | 'github_app_authorization'
            | 'github_app_authorization.revoked'
            | 'gollum'
            | 'installation'
            | 'installation.created'
            | 'installation.deleted'
            | 'installation.new_permissions_accepted'
            | 'installation.suspend'
            | 'installation.unsuspend'
            | 'installation_repositories'
            | 'installation_repositories.added'
            | 'installation_repositories.removed'
            | 'issue_comment'
            | 'issue_comment.created'
            | 'issue_comment.deleted'
            | 'issue_comment.edited'
            | 'issues'
            | 'issues.assigned'
            | 'issues.closed'
            | 'issues.deleted'
            | 'issues.demilestoned'
            | 'issues.edited'
            | 'issues.labeled'
            | 'issues.locked'
            | 'issues.milestoned'
            | 'issues.opened'
            | 'issues.pinned'
            | 'issues.reopened'
            | 'issues.transferred'
            | 'issues.unassigned'
            | 'issues.unlabeled'
            | 'issues.unlocked'
            | 'issues.unpinned'
            | 'label'
            | 'label.created'
            | 'label.deleted'
            | 'label.edited'
            | 'marketplace_purchase'
            | 'marketplace_purchase.cancelled'
            | 'marketplace_purchase.changed'
            | 'marketplace_purchase.pending_change'
            | 'marketplace_purchase.pending_change_cancelled'
            | 'marketplace_purchase.purchased'
            | 'member'
            | 'member.added'
            | 'member.edited'
            | 'member.removed'
            | 'membership'
            | 'membership.added'
            | 'membership.removed'
            | 'meta'
            | 'meta.deleted'
            | 'milestone'
            | 'milestone.closed'
            | 'milestone.created'
            | 'milestone.deleted'
            | 'milestone.edited'
            | 'milestone.opened'
            | 'org_block'
            | 'org_block.blocked'
            | 'org_block.unblocked'
            | 'organization'
            | 'organization.deleted'
            | 'organization.member_added'
            | 'organization.member_invited'
            | 'organization.member_removed'
            | 'organization.renamed'
            | 'package'
            | 'package.published'
            | 'package.updated'
            | 'page_build'
            | 'ping'
            | 'project'
            | 'project.closed'
            | 'project.created'
            | 'project.deleted'
            | 'project.edited'
            | 'project.reopened'
            | 'project_card'
            | 'project_card.converted'
            | 'project_card.created'
            | 'project_card.deleted'
            | 'project_card.edited'
            | 'project_card.moved'
            | 'project_column'
            | 'project_column.created'
            | 'project_column.deleted'
            | 'project_column.edited'
            | 'project_column.moved'
            | 'public'
            | 'pull_request'
            | 'pull_request.assigned'
            | 'pull_request.auto_merge_disabled'
            | 'pull_request.auto_merge_enabled'
            | 'pull_request.closed'
            | 'pull_request.converted_to_draft'
            | 'pull_request.edited'
            | 'pull_request.labeled'
            | 'pull_request.locked'
            | 'pull_request.opened'
            | 'pull_request.ready_for_review'
            | 'pull_request.reopened'
            | 'pull_request.review_request_removed'
            | 'pull_request.review_requested'
            | 'pull_request.synchronize'
            | 'pull_request.unassigned'
            | 'pull_request.unlabeled'
            | 'pull_request.unlocked'
            | 'pull_request_review'
            | 'pull_request_review.dismissed'
            | 'pull_request_review.edited'
            | 'pull_request_review.submitted'
            | 'pull_request_review_comment'
            | 'pull_request_review_comment.created'
            | 'pull_request_review_comment.deleted'
            | 'pull_request_review_comment.edited'
            | 'push'
            | 'release'
            | 'release.created'
            | 'release.deleted'
            | 'release.edited'
            | 'release.prereleased'
            | 'release.published'
            | 'release.released'
            | 'release.unpublished'
            | 'repository'
            | 'repository.archived'
            | 'repository.created'
            | 'repository.deleted'
            | 'repository.edited'
            | 'repository.privatized'
            | 'repository.publicized'
            | 'repository.renamed'
            | 'repository.transferred'
            | 'repository.unarchived'
            | 'repository_dispatch'
            | 'repository_dispatch.on-demand-test'
            | 'repository_import'
            | 'repository_vulnerability_alert'
            | 'repository_vulnerability_alert.create'
            | 'repository_vulnerability_alert.dismiss'
            | 'repository_vulnerability_alert.resolve'
            | 'secret_scanning_alert'
            | 'secret_scanning_alert.created'
            | 'secret_scanning_alert.reopened'
            | 'secret_scanning_alert.resolved'
            | 'security_advisory'
            | 'security_advisory.performed'
            | 'security_advisory.published'
            | 'security_advisory.updated'
            | 'security_advisory.withdrawn'
            | 'sponsorship'
            | 'sponsorship.cancelled'
            | 'sponsorship.created'
            | 'sponsorship.edited'
            | 'sponsorship.pending_cancellation'
            | 'sponsorship.pending_tier_change'
            | 'sponsorship.tier_changed'
            | 'star'
            | 'star.created'
            | 'star.deleted'
            | 'status'
            | 'team'
            | 'team.added_to_repository'
            | 'team.created'
            | 'team.deleted'
            | 'team.edited'
            | 'team.removed_from_repository'
            | 'team_add'
            | 'watch'
            | 'watch.started'
            | 'workflow_dispatch'
            | 'workflow_job'
            | 'workflow_job.completed'
            | 'workflow_job.queued'
            | 'workflow_job.started'
            | 'workflow_run'
            | 'workflow_run.completed'
            | 'workflow_run.requested'
            >(
            event: E | E[],
            callback: HandlerFunction<E, TTransformed>
            ) => void;

              property onAny

              onAny: (callback: (event: EmitterWebhookEvent) => any) => void;

                property onError

                onError: (callback: (event: WebhookEventHandlerError) => any) => void;

                  property receive

                  receive: (event: EmitterWebhookEvent) => Promise<void>;

                    property removeListener

                    removeListener: <
                    E extends
                    | 'branch_protection_rule'
                    | 'branch_protection_rule.created'
                    | 'branch_protection_rule.deleted'
                    | 'branch_protection_rule.edited'
                    | 'check_run'
                    | 'check_run.completed'
                    | 'check_run.created'
                    | 'check_run.requested_action'
                    | 'check_run.rerequested'
                    | 'check_suite'
                    | 'check_suite.completed'
                    | 'check_suite.requested'
                    | 'check_suite.rerequested'
                    | 'code_scanning_alert'
                    | 'code_scanning_alert.appeared_in_branch'
                    | 'code_scanning_alert.closed_by_user'
                    | 'code_scanning_alert.created'
                    | 'code_scanning_alert.fixed'
                    | 'code_scanning_alert.reopened'
                    | 'code_scanning_alert.reopened_by_user'
                    | 'commit_comment'
                    | 'commit_comment.created'
                    | 'content_reference'
                    | 'content_reference.created'
                    | 'create'
                    | 'delete'
                    | 'deploy_key'
                    | 'deploy_key.created'
                    | 'deploy_key.deleted'
                    | 'deployment'
                    | 'deployment.created'
                    | 'deployment_status'
                    | 'deployment_status.created'
                    | 'discussion'
                    | 'discussion.answered'
                    | 'discussion.category_changed'
                    | 'discussion.created'
                    | 'discussion.deleted'
                    | 'discussion.edited'
                    | 'discussion.labeled'
                    | 'discussion.locked'
                    | 'discussion.pinned'
                    | 'discussion.transferred'
                    | 'discussion.unanswered'
                    | 'discussion.unlabeled'
                    | 'discussion.unlocked'
                    | 'discussion.unpinned'
                    | 'discussion_comment'
                    | 'discussion_comment.created'
                    | 'discussion_comment.deleted'
                    | 'discussion_comment.edited'
                    | 'fork'
                    | 'github_app_authorization'
                    | 'github_app_authorization.revoked'
                    | 'gollum'
                    | 'installation'
                    | 'installation.created'
                    | 'installation.deleted'
                    | 'installation.new_permissions_accepted'
                    | 'installation.suspend'
                    | 'installation.unsuspend'
                    | 'installation_repositories'
                    | 'installation_repositories.added'
                    | 'installation_repositories.removed'
                    | 'issue_comment'
                    | 'issue_comment.created'
                    | 'issue_comment.deleted'
                    | 'issue_comment.edited'
                    | 'issues'
                    | 'issues.assigned'
                    | 'issues.closed'
                    | 'issues.deleted'
                    | 'issues.demilestoned'
                    | 'issues.edited'
                    | 'issues.labeled'
                    | 'issues.locked'
                    | 'issues.milestoned'
                    | 'issues.opened'
                    | 'issues.pinned'
                    | 'issues.reopened'
                    | 'issues.transferred'
                    | 'issues.unassigned'
                    | 'issues.unlabeled'
                    | 'issues.unlocked'
                    | 'issues.unpinned'
                    | 'label'
                    | 'label.created'
                    | 'label.deleted'
                    | 'label.edited'
                    | 'marketplace_purchase'
                    | 'marketplace_purchase.cancelled'
                    | 'marketplace_purchase.changed'
                    | 'marketplace_purchase.pending_change'
                    | 'marketplace_purchase.pending_change_cancelled'
                    | 'marketplace_purchase.purchased'
                    | 'member'
                    | 'member.added'
                    | 'member.edited'
                    | 'member.removed'
                    | 'membership'
                    | 'membership.added'
                    | 'membership.removed'
                    | 'meta'
                    | 'meta.deleted'
                    | 'milestone'
                    | 'milestone.closed'
                    | 'milestone.created'
                    | 'milestone.deleted'
                    | 'milestone.edited'
                    | 'milestone.opened'
                    | 'org_block'
                    | 'org_block.blocked'
                    | 'org_block.unblocked'
                    | 'organization'
                    | 'organization.deleted'
                    | 'organization.member_added'
                    | 'organization.member_invited'
                    | 'organization.member_removed'
                    | 'organization.renamed'
                    | 'package'
                    | 'package.published'
                    | 'package.updated'
                    | 'page_build'
                    | 'ping'
                    | 'project'
                    | 'project.closed'
                    | 'project.created'
                    | 'project.deleted'
                    | 'project.edited'
                    | 'project.reopened'
                    | 'project_card'
                    | 'project_card.converted'
                    | 'project_card.created'
                    | 'project_card.deleted'
                    | 'project_card.edited'
                    | 'project_card.moved'
                    | 'project_column'
                    | 'project_column.created'
                    | 'project_column.deleted'
                    | 'project_column.edited'
                    | 'project_column.moved'
                    | 'public'
                    | 'pull_request'
                    | 'pull_request.assigned'
                    | 'pull_request.auto_merge_disabled'
                    | 'pull_request.auto_merge_enabled'
                    | 'pull_request.closed'
                    | 'pull_request.converted_to_draft'
                    | 'pull_request.edited'
                    | 'pull_request.labeled'
                    | 'pull_request.locked'
                    | 'pull_request.opened'
                    | 'pull_request.ready_for_review'
                    | 'pull_request.reopened'
                    | 'pull_request.review_request_removed'
                    | 'pull_request.review_requested'
                    | 'pull_request.synchronize'
                    | 'pull_request.unassigned'
                    | 'pull_request.unlabeled'
                    | 'pull_request.unlocked'
                    | 'pull_request_review'
                    | 'pull_request_review.dismissed'
                    | 'pull_request_review.edited'
                    | 'pull_request_review.submitted'
                    | 'pull_request_review_comment'
                    | 'pull_request_review_comment.created'
                    | 'pull_request_review_comment.deleted'
                    | 'pull_request_review_comment.edited'
                    | 'push'
                    | 'release'
                    | 'release.created'
                    | 'release.deleted'
                    | 'release.edited'
                    | 'release.prereleased'
                    | 'release.published'
                    | 'release.released'
                    | 'release.unpublished'
                    | 'repository'
                    | 'repository.archived'
                    | 'repository.created'
                    | 'repository.deleted'
                    | 'repository.edited'
                    | 'repository.privatized'
                    | 'repository.publicized'
                    | 'repository.renamed'
                    | 'repository.transferred'
                    | 'repository.unarchived'
                    | 'repository_dispatch'
                    | 'repository_dispatch.on-demand-test'
                    | 'repository_import'
                    | 'repository_vulnerability_alert'
                    | 'repository_vulnerability_alert.create'
                    | 'repository_vulnerability_alert.dismiss'
                    | 'repository_vulnerability_alert.resolve'
                    | 'secret_scanning_alert'
                    | 'secret_scanning_alert.created'
                    | 'secret_scanning_alert.reopened'
                    | 'secret_scanning_alert.resolved'
                    | 'security_advisory'
                    | 'security_advisory.performed'
                    | 'security_advisory.published'
                    | 'security_advisory.updated'
                    | 'security_advisory.withdrawn'
                    | 'sponsorship'
                    | 'sponsorship.cancelled'
                    | 'sponsorship.created'
                    | 'sponsorship.edited'
                    | 'sponsorship.pending_cancellation'
                    | 'sponsorship.pending_tier_change'
                    | 'sponsorship.tier_changed'
                    | 'star'
                    | 'star.created'
                    | 'star.deleted'
                    | 'status'
                    | 'team'
                    | 'team.added_to_repository'
                    | 'team.created'
                    | 'team.deleted'
                    | 'team.edited'
                    | 'team.removed_from_repository'
                    | 'team_add'
                    | 'watch'
                    | 'watch.started'
                    | 'workflow_dispatch'
                    | 'workflow_job'
                    | 'workflow_job.completed'
                    | 'workflow_job.queued'
                    | 'workflow_job.started'
                    | 'workflow_run'
                    | 'workflow_run.completed'
                    | 'workflow_run.requested'
                    >(
                    event: E | E[],
                    callback: HandlerFunction<E, TTransformed>
                    ) => void;

                      property sign

                      sign: (payload: string | object) => Promise<string>;

                        property verify

                        verify: (eventPayload: string | object, signature: string) => Promise<boolean>;

                          property verifyAndReceive

                          verifyAndReceive: (
                          options:
                          | EmitterWebhookEventWithStringPayloadAndSignature
                          | EmitterWebhookEventWithSignature
                          ) => Promise<void>;

                            Type Aliases

                            type EmitterWebhookEvent

                            type EmitterWebhookEvent<
                            TEmitterEvent extends EmitterWebhookEventName = EmitterWebhookEventName
                            > = TEmitterEvent extends `${infer TWebhookEvent}.${infer TAction}`
                            ? BaseWebhookEvent<Extract<TWebhookEvent, WebhookEventName>> & {
                            payload: {
                            action: TAction;
                            };
                            }
                            : BaseWebhookEvent<Extract<TEmitterEvent, WebhookEventName>>;

                              type EmitterWebhookEventName

                              type EmitterWebhookEventName = typeof emitterEventNames[number];

                                type WebhookError

                                type WebhookError = Error & Partial<RequestError>;
                                • Error object with optional properties coming from octokit.request errors

                                Package Files (5)

                                Dependencies (4)

                                Dev Dependencies (23)

                                Peer Dependencies (0)

                                No peer dependencies.

                                Badge

                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@octokit/webhooks.

                                • Markdown
                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@octokit/webhooks)
                                • HTML
                                  <a href="https://www.jsdocs.io/package/@octokit/webhooks"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>