Options
All
  • Public
  • Public/Protected
  • All
Menu

The app parameter available to ApplicationFunctions

property

{logger} log - A logger

Hierarchy

  • Application

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

app

app: OctokitApp

cache

cache: Cache

events

events: EventEmitter

log

router

router: express.Router

Methods

Private auth

  • Authenticate and get a GitHub client that can be used to make API calls.

    You'll probably want to use context.github instead.

    Note: app.auth is asynchronous, so it needs to be prefixed with a await to wait for the magic to happen.

     module.exports = (app) => {
       app.on('issues.opened', async context => {
         const github = await app.auth();
       });
     };

    Parameters

    • Optional id: undefined | number

      ID of the installation, which can be extracted from context.payload.installation.id. If called without this parameter, the client wil authenticate as the app instead of as a specific installation, which means it can only be used for app APIs.

    • Default value log: LoggerWithTarget = this.log

    Returns Promise<GitHubAPI>

    An authenticated GitHub API client

load

on

  • on(event: "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested", callback: OnCallback<Webhooks.WebhookPayloadCheckRun>): void
  • on(event: "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested", callback: OnCallback<Webhooks.WebhookPayloadCheckSuite>): void
  • on(event: "commit_comment" | "commit_comment.created", callback: OnCallback<Webhooks.WebhookPayloadCommitComment>): void
  • on(event: "create", callback: OnCallback<Webhooks.WebhookPayloadCreate>): void
  • on(event: "delete", callback: OnCallback<Webhooks.WebhookPayloadDelete>): void
  • on(event: "deployment", callback: OnCallback<Webhooks.WebhookPayloadDeployment>): void
  • on(event: "deployment_status", callback: OnCallback<Webhooks.WebhookPayloadDeploymentStatus>): void
  • on(event: "fork", callback: OnCallback<Webhooks.WebhookPayloadFork>): void
  • on(event: "github_app_authorization", callback: OnCallback<Webhooks.WebhookPayloadGithubAppAuthorization>): void
  • on(event: "gollum", callback: OnCallback<Webhooks.WebhookPayloadGollum>): void
  • on(event: "installation" | "installation.created" | "installation.deleted", callback: OnCallback<Webhooks.WebhookPayloadInstallation>): void
  • on(event: "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed", callback: OnCallback<Webhooks.WebhookPayloadInstallationRepositories>): void
  • on(event: "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited", callback: OnCallback<Webhooks.WebhookPayloadIssueComment>): void
  • on(event: "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.milestoned" | "issues.opened" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled", callback: OnCallback<Webhooks.WebhookPayloadIssues>): void
  • on(event: "label" | "label.created" | "label.deleted" | "label.edited", callback: OnCallback<Webhooks.WebhookPayloadLabel>): void
  • on(event: "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased", callback: OnCallback<Webhooks.WebhookPayloadMarketplacePurchase>): void
  • on(event: "member" | "member.added" | "member.deleted" | "member.edited", callback: OnCallback<Webhooks.WebhookPayloadMember>): void
  • on(event: "membership" | "membership.added" | "membership.removed", callback: OnCallback<Webhooks.WebhookPayloadMembership>): void
  • on(event: "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened", callback: OnCallback<Webhooks.WebhookPayloadMilestone>): void
  • on(event: "organization" | "organization.member_added" | "organization.member_invited" | "organization.member_removed", callback: OnCallback<Webhooks.WebhookPayloadOrganization>): void
  • on(event: "org_block" | "org_block.blocked" | "org_block.unblocked", callback: OnCallback<Webhooks.WebhookPayloadOrgBlock>): void
  • on(event: "page_build", callback: OnCallback<Webhooks.WebhookPayloadPageBuild>): void
  • on(event: "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved", callback: OnCallback<Webhooks.WebhookPayloadProjectCard>): void
  • on(event: "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved", callback: OnCallback<Webhooks.WebhookPayloadProjectColumn>): void
  • on(event: "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened", callback: OnCallback<Webhooks.WebhookPayloadProject>): void
  • on(event: "public", callback: OnCallback<Webhooks.WebhookPayloadPublic>): void
  • on(event: "pull_request" | "pull_request.assigned" | "pull_request.closed" | "pull_request.edited" | "pull_request.labeled" | "pull_request.opened" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.synchronize", callback: OnCallback<Webhooks.WebhookPayloadPullRequest>): void
  • on(event: "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted", callback: OnCallback<Webhooks.WebhookPayloadPullRequestReview>): void
  • on(event: "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited", callback: OnCallback<Webhooks.WebhookPayloadPullRequestReviewComment>): void
  • on(event: "push", callback: OnCallback<Webhooks.WebhookPayloadPush>): void
  • on(event: "release" | "release.published", callback: OnCallback<Webhooks.WebhookPayloadRelease>): void
  • on(event: "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.privatized" | "repository.publicized" | "repository.unarchived", callback: OnCallback<Webhooks.WebhookPayloadRepository>): void
  • on(event: "repository_import", callback: OnCallback<Webhooks.WebhookPayloadRepositoryImport>): void
  • on(event: "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.resolve", callback: OnCallback<Webhooks.WebhookPayloadRepositoryVulnerabilityAlert>): void
  • on(event: "security_advisory" | "security_advisory.performed" | "security_advisory.published" | "security_advisory.updated", callback: OnCallback<Webhooks.WebhookPayloadSecurityAdvisory>): void
  • on(event: "status", callback: OnCallback<Webhooks.WebhookPayloadStatus>): void
  • on(event: "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository", callback: OnCallback<Webhooks.WebhookPayloadTeam>): void
  • on(event: "team_add", callback: OnCallback<Webhooks.WebhookPayloadTeamAdd>): void
  • on(event: "watch" | "watch.started", callback: OnCallback<Webhooks.WebhookPayloadWatch>): void
  • on(eventName: string | string[], callback: OnCallback<any>): void
  • Listen for GitHub webhooks, which are fired for almost every significant action that users take on GitHub.

    Parameters

    • event: "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested"

      the name of the GitHub webhook event. Most events also include an "action". For example, the * issues event has actions of assigned, unassigned, labeled, unlabeled, opened, edited, milestoned, demilestoned, closed, and reopened. Often, your bot will only care about one type of action, so you can append it to the event name with a ., like issues.closed.

      app.on('push', context => {
        // Code was just pushed.
      });
      
      app.on('issues.opened', context => {
        // An issue was just opened.
      });
    • callback: OnCallback<Webhooks.WebhookPayloadCheckRun>

      a function to call when the webhook is received.

    Returns void

  • Parameters

    • event: "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested"
    • callback: OnCallback<Webhooks.WebhookPayloadCheckSuite>

    Returns void

  • Parameters

    • event: "commit_comment" | "commit_comment.created"
    • callback: OnCallback<Webhooks.WebhookPayloadCommitComment>

    Returns void

  • Parameters

    • event: "create"
    • callback: OnCallback<Webhooks.WebhookPayloadCreate>

    Returns void

  • Parameters

    • event: "delete"
    • callback: OnCallback<Webhooks.WebhookPayloadDelete>

    Returns void

  • Parameters

    • event: "deployment"
    • callback: OnCallback<Webhooks.WebhookPayloadDeployment>

    Returns void

  • Parameters

    • event: "deployment_status"
    • callback: OnCallback<Webhooks.WebhookPayloadDeploymentStatus>

    Returns void

  • Parameters

    • event: "fork"
    • callback: OnCallback<Webhooks.WebhookPayloadFork>

    Returns void

  • Parameters

    • event: "github_app_authorization"
    • callback: OnCallback<Webhooks.WebhookPayloadGithubAppAuthorization>

    Returns void

  • Parameters

    • event: "gollum"
    • callback: OnCallback<Webhooks.WebhookPayloadGollum>

    Returns void

  • Parameters

    • event: "installation" | "installation.created" | "installation.deleted"
    • callback: OnCallback<Webhooks.WebhookPayloadInstallation>

    Returns void

  • Parameters

    • event: "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed"
    • callback: OnCallback<Webhooks.WebhookPayloadInstallationRepositories>

    Returns void

  • Parameters

    • event: "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited"
    • callback: OnCallback<Webhooks.WebhookPayloadIssueComment>

    Returns void

  • Parameters

    • event: "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.milestoned" | "issues.opened" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled"
    • callback: OnCallback<Webhooks.WebhookPayloadIssues>

    Returns void

  • Parameters

    • event: "label" | "label.created" | "label.deleted" | "label.edited"
    • callback: OnCallback<Webhooks.WebhookPayloadLabel>

    Returns void

  • Parameters

    • event: "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased"
    • callback: OnCallback<Webhooks.WebhookPayloadMarketplacePurchase>

    Returns void

  • Parameters

    • event: "member" | "member.added" | "member.deleted" | "member.edited"
    • callback: OnCallback<Webhooks.WebhookPayloadMember>

    Returns void

  • Parameters

    • event: "membership" | "membership.added" | "membership.removed"
    • callback: OnCallback<Webhooks.WebhookPayloadMembership>

    Returns void

  • Parameters

    • event: "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened"
    • callback: OnCallback<Webhooks.WebhookPayloadMilestone>

    Returns void

  • Parameters

    • event: "organization" | "organization.member_added" | "organization.member_invited" | "organization.member_removed"
    • callback: OnCallback<Webhooks.WebhookPayloadOrganization>

    Returns void

  • Parameters

    • event: "org_block" | "org_block.blocked" | "org_block.unblocked"
    • callback: OnCallback<Webhooks.WebhookPayloadOrgBlock>

    Returns void

  • Parameters

    • event: "page_build"
    • callback: OnCallback<Webhooks.WebhookPayloadPageBuild>

    Returns void

  • Parameters

    • event: "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved"
    • callback: OnCallback<Webhooks.WebhookPayloadProjectCard>

    Returns void

  • Parameters

    • event: "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved"
    • callback: OnCallback<Webhooks.WebhookPayloadProjectColumn>

    Returns void

  • Parameters

    • event: "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened"
    • callback: OnCallback<Webhooks.WebhookPayloadProject>

    Returns void

  • Parameters

    • event: "public"
    • callback: OnCallback<Webhooks.WebhookPayloadPublic>

    Returns void

  • Parameters

    • event: "pull_request" | "pull_request.assigned" | "pull_request.closed" | "pull_request.edited" | "pull_request.labeled" | "pull_request.opened" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.synchronize"
    • callback: OnCallback<Webhooks.WebhookPayloadPullRequest>

    Returns void

  • Parameters

    • event: "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted"
    • callback: OnCallback<Webhooks.WebhookPayloadPullRequestReview>

    Returns void

  • Parameters

    • event: "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited"
    • callback: OnCallback<Webhooks.WebhookPayloadPullRequestReviewComment>

    Returns void

  • Parameters

    • event: "push"
    • callback: OnCallback<Webhooks.WebhookPayloadPush>

    Returns void

  • Parameters

    • event: "release" | "release.published"
    • callback: OnCallback<Webhooks.WebhookPayloadRelease>

    Returns void

  • Parameters

    • event: "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.privatized" | "repository.publicized" | "repository.unarchived"
    • callback: OnCallback<Webhooks.WebhookPayloadRepository>

    Returns void

  • Parameters

    • event: "repository_import"
    • callback: OnCallback<Webhooks.WebhookPayloadRepositoryImport>

    Returns void

  • Parameters

    • event: "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.resolve"
    • callback: OnCallback<Webhooks.WebhookPayloadRepositoryVulnerabilityAlert>

    Returns void

  • Parameters

    • event: "security_advisory" | "security_advisory.performed" | "security_advisory.published" | "security_advisory.updated"
    • callback: OnCallback<Webhooks.WebhookPayloadSecurityAdvisory>

    Returns void

  • Parameters

    • event: "status"
    • callback: OnCallback<Webhooks.WebhookPayloadStatus>

    Returns void

  • Parameters

    • event: "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository"
    • callback: OnCallback<Webhooks.WebhookPayloadTeam>

    Returns void

  • Parameters

    • event: "team_add"
    • callback: OnCallback<Webhooks.WebhookPayloadTeamAdd>

    Returns void

  • Parameters

    • event: "watch" | "watch.started"
    • callback: OnCallback<Webhooks.WebhookPayloadWatch>

    Returns void

  • Parameters

    • eventName: string | string[]
    • callback: OnCallback<any>

    Returns void

receive

  • receive(event: WebhookEvent<any>): Promise<[void, void, void]>
  • Parameters

    • event: WebhookEvent<any>

    Returns Promise<[void, void, void]>

route

  • route(path?: undefined | string): express.Router
  • Get an express router that can be used to expose HTTP endpoints

    module.exports = app => {
      // Get an express router to expose new HTTP endpoints
      const route = app.route('/my-app');
    
      // Use any middleware
      route.use(require('express').static(__dirname + '/public'));
    
      // Add a new route
      route.get('/hello-world', (req, res) => {
        res.end('Hello World');
      });
    };

    Parameters

    • Optional path: undefined | string

      the prefix for the routes

    Returns express.Router

    an express.Router

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc