Webhooks
Issue Comment Event

Usage

import * as github from "@trigger.dev/github";

new Trigger({
  id: "demo",
  on: github.events.issueCommentEvent({
    repo: "triggerdotdev/trigger.dev",
  }),
  run: async (event, ctx) => {},
}).listen();

Params

reporequired
string

The full path to the repository, including the organization

Event

action
string

The issue_comment action, which can be either created, deleted, or edited.

commentrequired
object

The comment object.

issuerequired
object

The issue object.

repositoryrequired
object

A repository on GitHub.

senderrequired
object

The GitHub user object who performed the action.

organization
object

The organization object the repository belongs to.

Example Workflows

new Trigger({
  id: "github-to-slack",
  name: "Notify Slack on new Issue comment",
  on: github.events.issueCommentEvent({
    repo: "triggerdotdev/trigger.dev",
  }),
  run: async (event, ctx) => {
    if (event.action === "created") {
      await slack.postMessage("New Comment", {
        channelName: "github-issues",
        text: `New comment on issue ${event.issue.title} by ${event.sender.login}: ${event.comment.html_url}`,
      });
    }
  },
}).listen();

Example Event payload

{
  "issue": {
    "id": 1548436712,
    "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1",
    "body": "Changed the body text once",
    "user": {
      "id": 10635986,
      "url": "https://api.github.com/users/matt-aitken",
      "type": "User",
      "login": "matt-aitken",
      "node_id": "MDQ6VXNlcjEwNjM1OTg2",
      "html_url": "https://github.com/matt-aitken",
      "gists_url": "https://api.github.com/users/matt-aitken/gists{/gist_id}",
      "repos_url": "https://api.github.com/users/matt-aitken/repos",
      "avatar_url": "https://avatars.githubusercontent.com/u/10635986?v=4",
      "events_url": "https://api.github.com/users/matt-aitken/events{/privacy}",
      "site_admin": false,
      "gravatar_id": "",
      "starred_url": "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}",
      "followers_url": "https://api.github.com/users/matt-aitken/followers",
      "following_url": "https://api.github.com/users/matt-aitken/following{/other_user}",
      "organizations_url": "https://api.github.com/users/matt-aitken/orgs",
      "subscriptions_url": "https://api.github.com/users/matt-aitken/subscriptions",
      "received_events_url": "https://api.github.com/users/matt-aitken/received_events"
    },
    "state": "open",
    "title": "Changed test issue title",
    "labels": [
      {
        "id": 5003355458,
        "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/labels/documentation",
        "name": "documentation",
        "color": "0075ca",
        "default": true,
        "node_id": "LA_kwDOIxVdCc8AAAABKjklQg",
        "description": "Improvements or additions to documentation"
      },
      {
        "id": 5003355474,
        "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/labels/enhancement",
        "name": "enhancement",
        "color": "a2eeef",
        "default": true,
        "node_id": "LA_kwDOIxVdCc8AAAABKjklUg",
        "description": "New feature or request"
      }
    ],
    "locked": false,
    "number": 1,
    "node_id": "I_kwDOIxVdCc5cS0To",
    "assignee": null,
    "comments": 6,
    "html_url": "https://github.com/triggerdotdev/trigger.dev-examples/issues/1",
    "assignees": [],
    "closed_at": null,
    "milestone": {
      "id": 8941544,
      "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/milestones/1",
      "state": "open",
      "title": "Test milestone",
      "due_on": "2023-01-20T08:00:00Z",
      "number": 1,
      "creator": {
        "id": 10635986,
        "url": "https://api.github.com/users/matt-aitken",
        "type": "User",
        "login": "matt-aitken",
        "node_id": "MDQ6VXNlcjEwNjM1OTg2",
        "html_url": "https://github.com/matt-aitken",
        "gists_url": "https://api.github.com/users/matt-aitken/gists{/gist_id}",
        "repos_url": "https://api.github.com/users/matt-aitken/repos",
        "avatar_url": "https://avatars.githubusercontent.com/u/10635986?v=4",
        "events_url": "https://api.github.com/users/matt-aitken/events{/privacy}",
        "site_admin": false,
        "gravatar_id": "",
        "starred_url": "https://api.github.com/users/matt-aitken/starred{/owner}{/repo}",
        "followers_url": "https://api.github.com/users/matt-aitken/followers",
        "following_url": "https://api.github.com/users/matt-aitken/following{/other_user}",
        "organizations_url": "https://api.github.com/users/matt-aitken/orgs",
        "subscriptions_url": "https://api.github.com/users/matt-aitken/subscriptions",
        "received_events_url": "https://api.github.com/users/matt-aitken/received_events"
      },
      "node_id": "MI_kwDOIxVdCc4AiG_o",
      "html_url": "https://github.com/triggerdotdev/trigger.dev-examples/milestone/1",
      "closed_at": null,
      "created_at": "2023-01-19T03:02:37Z",
      "labels_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/milestones/1/labels",
      "updated_at": "2023-01-19T17:21:25Z",
      "description": "",
      "open_issues": 1,
      "closed_issues": 0
    },
    "reactions": {
      "+1": 0,
      "-1": 0,
      "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1/reactions",
      "eyes": 0,
      "heart": 0,
      "laugh": 0,
      "hooray": 0,
      "rocket": 0,
      "confused": 0,
      "total_count": 0
    },
    "created_at": "2023-01-19T02:50:49Z",
    "events_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1/events",
    "labels_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1/labels{/name}",
    "updated_at": "2023-01-24T04:18:52Z",
    "comments_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1/comments",
    "state_reason": "reopened",
    "timeline_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1/timeline",
    "repository_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples",
    "active_lock_reason": null,
    "author_association": "MEMBER",
    "performed_via_github_app": null
  },
  "action": "created",
  "sender": {
    "id": 534,
    "url": "https://api.github.com/users/ericallam",
    "type": "User",
    "login": "ericallam",
    "node_id": "MDQ6VXNlcjUzNA==",
    "html_url": "https://github.com/ericallam",
    "gists_url": "https://api.github.com/users/ericallam/gists{/gist_id}",
    "repos_url": "https://api.github.com/users/ericallam/repos",
    "avatar_url": "https://avatars.githubusercontent.com/u/534?v=4",
    "events_url": "https://api.github.com/users/ericallam/events{/privacy}",
    "site_admin": false,
    "gravatar_id": "",
    "starred_url": "https://api.github.com/users/ericallam/starred{/owner}{/repo}",
    "followers_url": "https://api.github.com/users/ericallam/followers",
    "following_url": "https://api.github.com/users/ericallam/following{/other_user}",
    "organizations_url": "https://api.github.com/users/ericallam/orgs",
    "subscriptions_url": "https://api.github.com/users/ericallam/subscriptions",
    "received_events_url": "https://api.github.com/users/ericallam/received_events"
  },
  "comment": {
    "id": 1401375866,
    "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/comments/1401375866",
    "body": "New comment",
    "user": {
      "id": 534,
      "url": "https://api.github.com/users/ericallam",
      "type": "User",
      "login": "ericallam",
      "node_id": "MDQ6VXNlcjUzNA==",
      "html_url": "https://github.com/ericallam",
      "gists_url": "https://api.github.com/users/ericallam/gists{/gist_id}",
      "repos_url": "https://api.github.com/users/ericallam/repos",
      "avatar_url": "https://avatars.githubusercontent.com/u/534?v=4",
      "events_url": "https://api.github.com/users/ericallam/events{/privacy}",
      "site_admin": false,
      "gravatar_id": "",
      "starred_url": "https://api.github.com/users/ericallam/starred{/owner}{/repo}",
      "followers_url": "https://api.github.com/users/ericallam/followers",
      "following_url": "https://api.github.com/users/ericallam/following{/other_user}",
      "organizations_url": "https://api.github.com/users/ericallam/orgs",
      "subscriptions_url": "https://api.github.com/users/ericallam/subscriptions",
      "received_events_url": "https://api.github.com/users/ericallam/received_events"
    },
    "node_id": "IC_kwDOIxVdCc5Th0x6",
    "html_url": "https://github.com/triggerdotdev/trigger.dev-examples/issues/1#issuecomment-1401375866",
    "issue_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/1",
    "reactions": {
      "+1": 0,
      "-1": 0,
      "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/comments/1401375866/reactions",
      "eyes": 0,
      "heart": 0,
      "laugh": 0,
      "hooray": 0,
      "rocket": 0,
      "confused": 0,
      "total_count": 0
    },
    "created_at": "2023-01-24T04:18:52Z",
    "updated_at": "2023-01-24T04:18:52Z",
    "author_association": "MEMBER",
    "performed_via_github_app": null
  },
  "repository": {
    "id": 588602633,
    "url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples",
    "fork": false,
    "name": "trigger.dev-examples",
    "size": 161,
    "forks": 0,
    "owner": {
      "id": 95297378,
      "url": "https://api.github.com/users/triggerdotdev",
      "type": "Organization",
      "login": "triggerdotdev",
      "node_id": "O_kgDOBa4fYg",
      "html_url": "https://github.com/triggerdotdev",
      "gists_url": "https://api.github.com/users/triggerdotdev/gists{/gist_id}",
      "repos_url": "https://api.github.com/users/triggerdotdev/repos",
      "avatar_url": "https://avatars.githubusercontent.com/u/95297378?v=4",
      "events_url": "https://api.github.com/users/triggerdotdev/events{/privacy}",
      "site_admin": false,
      "gravatar_id": "",
      "starred_url": "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}",
      "followers_url": "https://api.github.com/users/triggerdotdev/followers",
      "following_url": "https://api.github.com/users/triggerdotdev/following{/other_user}",
      "organizations_url": "https://api.github.com/users/triggerdotdev/orgs",
      "subscriptions_url": "https://api.github.com/users/triggerdotdev/subscriptions",
      "received_events_url": "https://api.github.com/users/triggerdotdev/received_events"
    },
    "topics": [],
    "git_url": "git://github.com/triggerdotdev/trigger.dev-examples.git",
    "license": null,
    "node_id": "R_kgDOIxVdCQ",
    "private": false,
    "ssh_url": "git@github.com:triggerdotdev/trigger.dev-examples.git",
    "svn_url": "https://github.com/triggerdotdev/trigger.dev-examples",
    "archived": false,
    "disabled": false,
    "has_wiki": false,
    "homepage": null,
    "html_url": "https://github.com/triggerdotdev/trigger.dev-examples",
    "keys_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/keys{/key_id}",
    "language": "TypeScript",
    "tags_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/tags",
    "watchers": 1,
    "blobs_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/git/blobs{/sha}",
    "clone_url": "https://github.com/triggerdotdev/trigger.dev-examples.git",
    "forks_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/forks",
    "full_name": "triggerdotdev/trigger.dev-examples",
    "has_pages": false,
    "hooks_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/hooks",
    "pulls_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/pulls{/number}",
    "pushed_at": "2023-01-23T19:06:36Z",
    "teams_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/teams",
    "trees_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/git/trees{/sha}",
    "created_at": "2023-01-13T14:26:45Z",
    "events_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/events",
    "has_issues": true,
    "issues_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues{/number}",
    "labels_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/labels{/name}",
    "merges_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/merges",
    "mirror_url": null,
    "updated_at": "2023-01-23T14:22:40Z",
    "visibility": "public",
    "archive_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/{archive_format}{/ref}",
    "commits_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/commits{/sha}",
    "compare_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/compare/{base}...{head}",
    "description": "Node.js project with multiple example Trigger.dev workflows",
    "forks_count": 0,
    "is_template": false,
    "open_issues": 2,
    "branches_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/branches{/branch}",
    "comments_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/comments{/number}",
    "contents_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/contents/{+path}",
    "git_refs_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/git/refs{/sha}",
    "git_tags_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/git/tags{/sha}",
    "has_projects": true,
    "releases_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/releases{/id}",
    "statuses_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/statuses/{sha}",
    "allow_forking": true,
    "assignees_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/assignees{/user}",
    "downloads_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/downloads",
    "has_downloads": false,
    "languages_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/languages",
    "default_branch": "main",
    "milestones_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/milestones{/number}",
    "stargazers_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/stargazers",
    "watchers_count": 1,
    "deployments_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/deployments",
    "git_commits_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/git/commits{/sha}",
    "has_discussions": false,
    "subscribers_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/subscribers",
    "contributors_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/contributors",
    "issue_events_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/events{/number}",
    "stargazers_count": 1,
    "subscription_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/subscription",
    "collaborators_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/collaborators{/collaborator}",
    "issue_comment_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/issues/comments{/number}",
    "notifications_url": "https://api.github.com/repos/triggerdotdev/trigger.dev-examples/notifications{?since,all,participating}",
    "open_issues_count": 2,
    "web_commit_signoff_required": false
  },
  "organization": {
    "id": 95297378,
    "url": "https://api.github.com/orgs/triggerdotdev",
    "login": "triggerdotdev",
    "node_id": "O_kgDOBa4fYg",
    "hooks_url": "https://api.github.com/orgs/triggerdotdev/hooks",
    "repos_url": "https://api.github.com/orgs/triggerdotdev/repos",
    "avatar_url": "https://avatars.githubusercontent.com/u/95297378?v=4",
    "events_url": "https://api.github.com/orgs/triggerdotdev/events",
    "issues_url": "https://api.github.com/orgs/triggerdotdev/issues",
    "description": "",
    "members_url": "https://api.github.com/orgs/triggerdotdev/members{/member}",
    "public_members_url": "https://api.github.com/orgs/triggerdotdev/public_members{/member}"
  }
}