From cbc976188e3dc590ec9ba8c4d61ed96200ab76c2 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 9 Oct 2023 16:48:38 +0100 Subject: [PATCH] GitHub docs improvements (#568) * Updated github-triggers and intro * Edited tasks / triggers and main overview page * Added links to scopes docs and improved copy * Added an overview, side bar title and improved the ordering / wording * Added the underlying Github client section and some formatting updates --------- Co-authored-by: Eric Allam Co-authored-by: Eric Allam --- docs/integrations/apis/github-tasks.mdx | 253 +- docs/integrations/apis/github-triggers.mdx | 3063 +++++++++++++++++++- docs/integrations/apis/github.mdx | 94 +- 3 files changed, 3302 insertions(+), 108 deletions(-) diff --git a/docs/integrations/apis/github-tasks.mdx b/docs/integrations/apis/github-tasks.mdx index 410dc1170..2dbc2e33d 100644 --- a/docs/integrations/apis/github-tasks.mdx +++ b/docs/integrations/apis/github-tasks.mdx @@ -1,54 +1,263 @@ --- -title: Tasks +title: GitHub Tasks +sidebarTitle: Tasks +--- + +Tasks are executed after the job is triggered and are the main building blocks of a job. You can string together as many tasks as you want. + --- ## All tasks -| Function Name | Description | -| -------------------------------- | ----------------------------------------------------------- | -| `createIssue` | Creates a new issue in a repository. | -| `addIssueAssignees` | Adds assignees to an existing issue. | -| `addIssueLabels` | Adds labels to an existing issue. | -| `createIssueComment` | Creates a new comment on an existing issue. | -| `getRepo` | Retrieves information about a repository. | -| `createIssueCommentWithReaction` | Creates a new comment on an existing issue with a reaction. | -| `addIssueCommentReaction` | Adds a reaction to an existing issue comment. | -| `updateWebhook` | Updates an existing webhook. | -| `createWebhook` | Creates a new webhook. | -| `listWebhooks` | Lists the webhooks for a repository. | -| `updateOrgWebhook` | Updates an existing webhook for an organization. | -| `createOrgWebhook` | Creates a new webhook for an organization. | -| `listOrgWebhooks` | Lists the webhooks for an organization. | +### `createIssue` -## Usage +Creates a new issue in a repository. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/issues/issues?apiVersion=2022-11-28#create-an-issue). + +```ts example.ts +await io.github.createIssue("create issue", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + title: "", // the title of the issue + body: "", // the contents of the issue +}); +``` + +### `addIssueAssignees` + +Adds assignees to an existing issue. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue). + +```ts example.ts +await io.github.addIssueAssignees("add assignee", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + issueNumber: , // the number of the issue + assignees: [""], // the name(s) of the assignee(s) +}); +``` + +### `addIssueLabels` + +Adds labels to an existing issue. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue). + +```ts example.ts +await io.github.addIssueLabels("add label", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + issueNumber: , // the number of the issue + labels: [""], // the name(s) of the label(s) +}); +``` + +### `createIssueComment` + +Creates a new comment on an existing issue. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment). + +```ts example.ts +await io.github.createIssueComment("create comment", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + issueNumber: , // the number of the issue + body: "", // the contents of the comment +}); +``` + +### `getRepo` + +Retrieves information about a repository. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/repos/repos?apiVersion=2022-11-28#get-a-repository). + +```ts example.ts +const repoInfo = await io.github.getRepo({ + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository +}); +``` + +### `createIssueCommentWithReaction` + +Creates a new comment on an existing issue with a reaction. [Official GitHub docs](https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment). + +```ts example.ts +await io.github.createIssueCommentWithReaction("create comment with reaction", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + issueNumber: , // the number of the issue + body: "", // the contents of the comment + content: "", // the type of reaction +}); +``` + +### `addIssueCommentReaction` + +Adds a reaction to an existing issue comment. [Official GitHub docs](https://docs.github.com/en/free-pro-team@latest/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment). + +```ts example.ts +await io.github.addIssueCommentReaction("add reaction", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + commentId: , // the id of the specific comment + content: "", // the type of reaction +}); +``` + +### `updateWebhook` + +Updates an existing webhook. [Official GitHub docs](https://docs.github.com/en/rest/webhooks/repos?apiVersion=2022-11-28#update-a-repository-webhook). + +```ts example.ts +await io.github.updateWebhook("update webhook", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + webhookId: , // the unique id of the webhook + config: { + url: "", // the url to which payloads will be delivered + contentType: "json", // the media type used to serialize the payloads + secret: "", // If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. + }, +}); +``` + +### `createWebhook` + +Creates a new webhook. [Official GitHub docs](https://docs.github.com/en/rest/webhooks/repos?apiVersion=2022-11-28#create-a-repository-webhook). + +```ts example.ts +await io.github.createWebhook("create webhook", { + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository + config: { + url: "", // the url to which payloads will be delivered + contentType: "json", // the media type used to serialize the payloads + secret: "", // If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. + }, + events: [""], // the events for which the webhook will trigger +}); +``` + +### `listWebhooks` + +Lists the webhooks for a repository. [Official GitHub docs](https://docs.github.com/en/rest/webhooks/repos?apiVersion=2022-11-28#list-repository-webhooks). + +```ts example.ts +const webhooks = await io.github.listWebhooks({ + owner: "", // the name of the owner of the repository + repo: "", // the name of the repository +}); +``` + +### `updateOrgWebhook` + +Updates an existing webhook for an organization. [Official GitHub docs](https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#update-an-organization-webhook). + +```ts +await io.github.updateOrgWebhook("update org webhook", { + org: "", // the name of the organization + webhookId: , // the unique id of the webhook + config: { + url: "", // the url to which payloads will be delivered + contentType: "json", // the media type used to serialize the payloads + secret: "", // If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. + }, +}); +``` + +### `createOrgWebhook` + +Creates a new webhook for an organization. [Official GitHub docs](https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#create-an-organization-webhook). + +```ts example.ts +await io.github.createOrgWebhook("create org webhook", { + org: "", // the name of the organization + config: { + url: "", // the url to which payloads will be delivered + contentType: "json", // the media type used to serialize the payloads + secret: "", // If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers. + }, + events: [""], // the events for which the webhook will trigger +}); +``` + +### `listOrgWebhooks` + +Lists the webhooks for an organization. [Official GitHub docs](https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#list-organization-webhooks). + +```ts example.ts +const orgWebhooks = await io.github.listOrgWebhooks({ + org: "", // the name of the organization + per-page: , // the number of webhooks to return per page (max 100) + page: , // Page number of the results to fetch. +}); +``` + +## Example usage + +In this example we'll create a task that adds an assignee and a label to an issue when it's opened. ```ts client.defineJob({ id: "github-integration-on-issue-opened", name: "GitHub Integration - On Issue Opened", - version: "0.1.0", + version: "1.0.0", integrations: { github }, trigger: github.triggers.repo({ event: events.onIssueOpened, - owner: "triggerdotdev", - repo: "empty", + owner: "", + repo: "", }), run: async (payload, io, ctx) => { await io.github.addIssueAssignees("add assignee", { owner: payload.repository.owner.login, repo: payload.repository.name, issueNumber: payload.issue.number, - assignees: ["matt-aitken"], + assignees: [""], }); await io.github.addIssueLabels("add label", { owner: payload.repository.owner.login, repo: payload.repository.name, issueNumber: payload.issue.number, - labels: ["bug"], + labels: [""], }); return { payload, ctx }; }, }); ``` + +## Using the underlying GitHub client + +You can access the [Octokit instance](https://github.com/octokit/octokit.js#octokit-api-client) by using the `runTask` method on the integration: + +```ts +const github = new Github({ + id: "github", +}); + +client.defineJob({ + id: "github-example-1", + name: "GitHub Example 1", + version: "0.1.0", + trigger: eventTrigger({ + name: "github.example", + }), + integrations: { + github, + }, + run: async (payload, io, ctx) => { + const contributors = await io.github.runTask( + "get-contributors", + async (octokit, task) => { + const contributors = await octokit.rest.repos.listContributors({ + owner: "", + repo: "", + }); + + return contributors; + }, + //this is optional, it will appear on the Run page + { name: "List Contributors" } + ); + }, +}); +``` + +Make sure to pass the `idempotencyKey` to the underlying client to ensure that the API call is only executed once. This is only needed for mutating API calls. diff --git a/docs/integrations/apis/github-triggers.mdx b/docs/integrations/apis/github-triggers.mdx index d66e62478..3b21ee59e 100644 --- a/docs/integrations/apis/github-triggers.mdx +++ b/docs/integrations/apis/github-triggers.mdx @@ -1,46 +1,3053 @@ --- -title: Triggers +title: GitHub Triggers & Events +sidebarTitle: Triggers & Events --- -## All triggers +You can use these triggers to start a job when a GitHub event occurs. -| Function Name | Description | -| --------------------- | -------------------------------------------------------------------------------- | -| `onIssue` | When any action is performed on an issue. | -| `onIssueOpened` | When an issue is opened. | -| `onIssueAssigned` | When an issue is assigned. | -| `onIssueComment` | When an issue is commented on. | -| `onStar` | When a repo is starred or unstarred. | -| `onNewStar` | When a repo is starred. | -| `onNewRepository` | When a new repo is created. | -| `onNewBranchOrTag` | When a new branch or tag is created. | -| `onNewBranch` | When a new branch is created. | -| `onPush` | When a push is made to a repo. | -| `onPullRequest` | When activity occurs on a pull request (excluding reviews, issues, or comments). | -| `onPullRequestReview` | When a pull request review has activity. | +--- -## Usage +### Repo + +Repo triggers subscribe to a change in a GitHub repo. ```ts -import { Github, events } from "@trigger.dev/github"; - -const github = new Github({ - id: "github", - token: process.env.GITHUB_TOKEN!, +github.triggers.repo({ + event: events.onIssueOpened, + owner: "triggerdotdev", + repo: "trigger.dev", }); +``` + + + + The event to trigger the job on. + + + The owner of the repo. + + + The name of the repo. + + + + +### Org + +Org triggers subscribe to a change across an entire GitHub org. + +```ts +github.triggers.repo({ + event: events.onIssueOpened, + owner: "triggerdotdev", +}); +``` + +}) + + + + + The event to trigger the job on. + + + The owner of the repo. + + + + +## Events + +### `onIssue` + +When any action is performed on an issue. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues). + +```ts usage.ts client.defineJob({ - id: "github-integration-on-issue", - name: "GitHub Integration - On Issue", + id: "", + name: "", version: "0.1.0", trigger: github.triggers.repo({ event: events.onIssue, - owner: "triggerdotdev", - repo: "empty", + owner: "", + repo: "", }), run: async (payload, io, ctx) => { - await io.logger.info("This is a simple log info message"); - //do stuff + // Add tasks here }, }); ``` + + +````json +{ + "issue": { + "id": 1754473379, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21", + "body": "This is a *big* problem:\r\n\r\n```\r\nconst foo = \"bar\"\r\n```", + "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": "This is a sample issue title #20", + "labels": [], + "locked": false, + "number": 21, + "node_id": "I_kwDOI-yZFc5okyOj", + "assignee": null, + "comments": 0, + "html_url": "https://github.com/ericallam/basic-starter-12k/issues/21", + "assignees": [], + "closed_at": null, + "milestone": null, + "reactions": { + "+1": 0, + "-1": 0, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/reactions", + "eyes": 0, + "heart": 0, + "laugh": 0, + "hooray": 0, + "rocket": 0, + "confused": 0, + "total_count": 0 + }, + "created_at": "2023-06-13T09:42:02Z", + "events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/events", + "labels_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/labels{/name}", + "updated_at": "2023-06-13T09:42:02Z", + "comments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/comments", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/timeline", + "repository_url": "https://api.github.com/repos/ericallam/basic-starter-12k", + "active_lock_reason": null, + "author_association": "NONE", + "performed_via_github_app": null + }, + "action": "opened", + "sender": { + "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" + }, + "repository": { + "id": 602708245, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k", + "fork": false, + "name": "basic-starter-12k", + "size": 0, + "forks": 0, + "owner": { + "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" + }, + "topics": [], + "git_url": "git://github.com/ericallam/basic-starter-12k.git", + "license": null, + "node_id": "R_kgDOI-yZFQ", + "private": false, + "ssh_url": "git@github.com:ericallam/basic-starter-12k.git", + "svn_url": "https://github.com/ericallam/basic-starter-12k", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/ericallam/basic-starter-12k", + "keys_url": "https://api.github.com/repos/ericallam/basic-starter-12k/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/ericallam/basic-starter-12k/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/blobs{/sha}", + "clone_url": "https://github.com/ericallam/basic-starter-12k.git", + "forks_url": "https://api.github.com/repos/ericallam/basic-starter-12k/forks", + "full_name": "ericallam/basic-starter-12k", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/ericallam/basic-starter-12k/hooks", + "pulls_url": "https://api.github.com/repos/ericallam/basic-starter-12k/pulls{/number}", + "pushed_at": "2023-02-16T19:25:20Z", + "teams_url": "https://api.github.com/repos/ericallam/basic-starter-12k/teams", + "trees_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/trees{/sha}", + "created_at": "2023-02-16T19:25:19Z", + "events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues{/number}", + "labels_url": "https://api.github.com/repos/ericallam/basic-starter-12k/labels{/name}", + "merges_url": "https://api.github.com/repos/ericallam/basic-starter-12k/merges", + "mirror_url": null, + "updated_at": "2023-02-16T19:25:19Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/ericallam/basic-starter-12k/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/ericallam/basic-starter-12k/commits{/sha}", + "compare_url": "https://api.github.com/repos/ericallam/basic-starter-12k/compare/{base}...{head}", + "description": null, + "forks_count": 0, + "is_template": false, + "open_issues": 21, + "branches_url": "https://api.github.com/repos/ericallam/basic-starter-12k/branches{/branch}", + "comments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/comments{/number}", + "contents_url": "https://api.github.com/repos/ericallam/basic-starter-12k/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/ericallam/basic-starter-12k/releases{/id}", + "statuses_url": "https://api.github.com/repos/ericallam/basic-starter-12k/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/ericallam/basic-starter-12k/assignees{/user}", + "downloads_url": "https://api.github.com/repos/ericallam/basic-starter-12k/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/ericallam/basic-starter-12k/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/ericallam/basic-starter-12k/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/ericallam/basic-starter-12k/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/deployments", + "git_commits_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/ericallam/basic-starter-12k/subscribers", + "contributors_url": "https://api.github.com/repos/ericallam/basic-starter-12k/contributors", + "issue_events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/ericallam/basic-starter-12k/subscription", + "collaborators_url": "https://api.github.com/repos/ericallam/basic-starter-12k/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/ericallam/basic-starter-12k/notifications{?since,all,participating}", + "open_issues_count": 21, + "web_commit_signoff_required": false + } +} +```` + + +### `onIssueOpened` + +Occurs when an issue is opened. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.org({ + event: events.onIssueOpened, + owner: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +````json +{ + "issue": { + "id": 1754473379, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21", + "body": "This is a *big* problem:\r\n\r\n```\r\nconst foo = \"bar\"\r\n```", + "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": "This is a sample issue title #20", + "labels": [], + "locked": false, + "number": 21, + "node_id": "I_kwDOI-yZFc5okyOj", + "assignee": null, + "comments": 0, + "html_url": "https://github.com/ericallam/basic-starter-12k/issues/21", + "assignees": [], + "closed_at": null, + "milestone": null, + "reactions": { + "+1": 0, + "-1": 0, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/reactions", + "eyes": 0, + "heart": 0, + "laugh": 0, + "hooray": 0, + "rocket": 0, + "confused": 0, + "total_count": 0 + }, + "created_at": "2023-06-13T09:42:02Z", + "events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/events", + "labels_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/labels{/name}", + "updated_at": "2023-06-13T09:42:02Z", + "comments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/comments", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/21/timeline", + "repository_url": "https://api.github.com/repos/ericallam/basic-starter-12k", + "active_lock_reason": null, + "author_association": "NONE", + "performed_via_github_app": null + }, + "action": "opened", + "sender": { + "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" + }, + "repository": { + "id": 602708245, + "url": "https://api.github.com/repos/ericallam/basic-starter-12k", + "fork": false, + "name": "basic-starter-12k", + "size": 0, + "forks": 0, + "owner": { + "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" + }, + "topics": [], + "git_url": "git://github.com/ericallam/basic-starter-12k.git", + "license": null, + "node_id": "R_kgDOI-yZFQ", + "private": false, + "ssh_url": "git@github.com:ericallam/basic-starter-12k.git", + "svn_url": "https://github.com/ericallam/basic-starter-12k", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/ericallam/basic-starter-12k", + "keys_url": "https://api.github.com/repos/ericallam/basic-starter-12k/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/ericallam/basic-starter-12k/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/blobs{/sha}", + "clone_url": "https://github.com/ericallam/basic-starter-12k.git", + "forks_url": "https://api.github.com/repos/ericallam/basic-starter-12k/forks", + "full_name": "ericallam/basic-starter-12k", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/ericallam/basic-starter-12k/hooks", + "pulls_url": "https://api.github.com/repos/ericallam/basic-starter-12k/pulls{/number}", + "pushed_at": "2023-02-16T19:25:20Z", + "teams_url": "https://api.github.com/repos/ericallam/basic-starter-12k/teams", + "trees_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/trees{/sha}", + "created_at": "2023-02-16T19:25:19Z", + "events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues{/number}", + "labels_url": "https://api.github.com/repos/ericallam/basic-starter-12k/labels{/name}", + "merges_url": "https://api.github.com/repos/ericallam/basic-starter-12k/merges", + "mirror_url": null, + "updated_at": "2023-02-16T19:25:19Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/ericallam/basic-starter-12k/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/ericallam/basic-starter-12k/commits{/sha}", + "compare_url": "https://api.github.com/repos/ericallam/basic-starter-12k/compare/{base}...{head}", + "description": null, + "forks_count": 0, + "is_template": false, + "open_issues": 21, + "branches_url": "https://api.github.com/repos/ericallam/basic-starter-12k/branches{/branch}", + "comments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/comments{/number}", + "contents_url": "https://api.github.com/repos/ericallam/basic-starter-12k/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/ericallam/basic-starter-12k/releases{/id}", + "statuses_url": "https://api.github.com/repos/ericallam/basic-starter-12k/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/ericallam/basic-starter-12k/assignees{/user}", + "downloads_url": "https://api.github.com/repos/ericallam/basic-starter-12k/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/ericallam/basic-starter-12k/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/ericallam/basic-starter-12k/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/ericallam/basic-starter-12k/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/ericallam/basic-starter-12k/deployments", + "git_commits_url": "https://api.github.com/repos/ericallam/basic-starter-12k/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/ericallam/basic-starter-12k/subscribers", + "contributors_url": "https://api.github.com/repos/ericallam/basic-starter-12k/contributors", + "issue_events_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/ericallam/basic-starter-12k/subscription", + "collaborators_url": "https://api.github.com/repos/ericallam/basic-starter-12k/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/ericallam/basic-starter-12k/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/ericallam/basic-starter-12k/notifications{?since,all,participating}", + "open_issues_count": 21, + "web_commit_signoff_required": false + } +} +```` + + +### `onIssueAssigned` + +When an issue is assigned. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onAssigned, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "id": "issue.assigned", + "name": "Issue assigned", + "payload": { + "issue": { + "id": 1767861922, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/4", + "body": "This is the bod", + "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": "Fourth time lucky?", + "labels": [], + "locked": false, + "number": 4, + "node_id": "I_kwDOJyTwbc5pX26i", + "assignee": { + "id": 10635986, + "url": "https://api.github.com/users/matt-aitken", + "type": "User", + "login": "matt-aitken", + "node_id": "MDQ6VXNlcjEwNjM5OTg2", + "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" + }, + "comments": 1, + "html_url": "https://github.com/triggerdotdev/empty/issues/4", + "assignees": [ + { + "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" + } + ], + "closed_at": null, + "milestone": null, + "reactions": { + "+1": 0, + "-1": 0, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/reactions", + "eyes": 0, + "heart": 0, + "laugh": 0, + "hooray": 0, + "rocket": 0, + "confused": 0, + "total_count": 0 + }, + "created_at": "2023-06-21T15:24:20Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/events", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/labels{/name}", + "updated_at": "2023-06-21T15:36:53Z", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/comments", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/timeline", + "repository_url": "https://api.github.com/repos/triggerdotdev/empty", + "active_lock_reason": null, + "author_association": "MEMBER", + "performed_via_github_app": null + }, + "action": "assigned", + "sender": { + "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" + }, + "assignee": { + "id": 10635986, + "url": "https://api.github.com/users/matt-aitken", + "type": "User", + "login": "matt-aitken", + "node_id": "MDQ6VXNlcjEwNjM5OTg2", + "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" + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T14:21:08Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T14:21:08Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "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}" + } + } +} +``` + + +### `onIssueComment` + +When an issue is commented on. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onIssueComment, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "payload": { + "issue": { + "id": 1767861922, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/4", + "body": "This is the bod", + "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": "Fourth time lucky?", + "labels": [], + "locked": false, + "number": 4, + "node_id": "I_kwDOJyTwbc5pX26i", + "assignee": { + "id": 10635986, + "url": "https://api.github.com/users/matt-aitken", + "type": "User", + "login": "matt-aitken", + "node_id": "MDQ6VXNlcjEwNjM5OTg2", + "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" + }, + "comments": 2, + "html_url": "https://github.com/triggerdotdev/empty/issues/4", + "assignees": [ + { + "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" + } + ], + "closed_at": null, + "milestone": null, + "reactions": { + "+1": 0, + "-1": 0, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/reactions", + "eyes": 0, + "heart": 0, + "laugh": 0, + "hooray": 0, + "rocket": 0, + "confused": 0, + "total_count": 0 + }, + "created_at": "2023-06-21T15:24:20Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/events", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/labels{/name}", + "updated_at": "2023-06-21T16:02:28Z", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/comments", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4/timeline", + "repository_url": "https://api.github.com/repos/triggerdotdev/empty", + "active_lock_reason": null, + "author_association": "MEMBER", + "performed_via_github_app": null + }, + "action": "created", + "sender": { + "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" + }, + "comment": { + "id": 1601114728, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments/1601114728", + "body": "This is a short comment with short code snippet:\r\n\r\n```\r\nconst rick = \"astley\";\r\n```", + "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" + }, + "node_id": "IC_kwDOJyTwbc5fbxJo", + "html_url": "https://github.com/triggerdotdev/empty/issues/4#issuecomment-1601114728", + "issue_url": "https://api.github.com/repos/triggerdotdev/empty/issues/4", + "reactions": { + "+1": 0, + "-1": 0, + "url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments/1601114728/reactions", + "eyes": 0, + "heart": 0, + "laugh": 0, + "hooray": 0, + "rocket": 0, + "confused": 0, + "total_count": 0 + }, + "created_at": "2023-06-21T16:02:27Z", + "updated_at": "2023-06-21T16:02:27Z", + "author_association": "MEMBER", + "performed_via_github_app": null + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T14:21:08Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T14:21:08Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "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}" + } + } +} +``` + + +### `onStar` + +When a repo is starred or unstarred. [Official GitHub docs](https://docs.github.com/en/rest/activity/starring?apiVersion=2022-11-28#list-stargazers). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onStar, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "payload": { + "action": "created", + "sender": { + "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" + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 1, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T14:21:08Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:22:03Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 1, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 1, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "web_commit_signoff_required": false + }, + "starred_at": "2023-06-21T17:22:03Z", + "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}" + } + } +} +``` + + +### `onNewStar` + +When a repo is starred. [Official GitHub docs](https://docs.github.com/en/rest/activity/starring?apiVersion=2022-11-28#list-stargazers). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onNewStar, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "payload": { + "action": "created", + "sender": { + "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" + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 1, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T14:21:08Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:22:03Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 1, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 1, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "web_commit_signoff_required": false + }, + "starred_at": "2023-06-21T17:22:03Z", + "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}" + } + } +} +``` + + +### `onNewRepository` + +When a new repo is created. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onNewRepository, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + +### `onNewBranchOrTag` + +When a new branch or tag is created. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onNewBranchOrTag, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "ref": "test", + "sender": { + "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" + }, + "ref_type": "branch", + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T17:54:25Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "web_commit_signoff_required": false + }, + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "pusher_type": "user", + "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}" + }, + "master_branch": "main" +} +``` + + +### `onNewBranch` + +When a new branch is created. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onNewBranch, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "ref": "test", + "sender": { + "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" + }, + "ref_type": "branch", + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T17:54:25Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "web_commit_signoff_required": false + }, + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "pusher_type": "user", + "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}" + }, + "master_branch": "main" +} +``` + + +### `onPush` + +When a push is made to a repo. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onPush, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "ref": "refs/heads/main", + "after": "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "before": "7f0b6655803858ac09ae05354a679d6dad03120c", + "forced": false, + "pusher": { + "name": "matt-aitken", + "email": "matt@mattaitken.com" + }, + "sender": { + "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" + }, + "commits": [ + { + "id": "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "url": "https://github.com/triggerdotdev/empty/commit/1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "added": [], + "author": { + "name": "Matt Aitken", + "email": "matt@mattaitken.com", + "username": "matt-aitken" + }, + "message": "Updated the readme", + "removed": [], + "tree_id": "3a584b2cae2fe34a195e1fe437cc62031ddff447", + "distinct": true, + "modified": ["README.md"], + "committer": { + "name": "Matt Aitken", + "email": "matt@mattaitken.com", + "username": "matt-aitken" + }, + "timestamp": "2023-06-21T19:27:16+01:00" + } + ], + "compare": "https://github.com/triggerdotdev/empty/compare/7f0b66558038...1ca6a91f4a13", + "created": false, + "deleted": false, + "base_ref": null, + "repository": { + "id": 656732269, + "url": "https://github.com/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "forks": 0, + "owner": { + "id": 95297378, + "url": "https://api.github.com/users/triggerdotdev", + "name": "triggerdotdev", + "type": "Organization", + "email": "hello@trigger.dev", + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": 1687372039, + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": 1687357267, + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "stargazers": 0, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 4, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "organization": "triggerdotdev", + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "master_branch": "main", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 4, + "web_commit_signoff_required": false + }, + "head_commit": { + "id": "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "url": "https://github.com/triggerdotdev/empty/commit/1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "added": [], + "author": { + "name": "Matt Aitken", + "email": "matt@mattaitken.com", + "username": "matt-aitken" + }, + "message": "Updated the readme", + "removed": [], + "tree_id": "3a584b2cae2fe34a195e1fe437cc62031ddff447", + "distinct": true, + "modified": ["README.md"], + "committer": { + "name": "Matt Aitken", + "email": "matt@mattaitken.com", + "username": "matt-aitken" + }, + "timestamp": "2023-06-21T19:27:16+01:00" + }, + "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}" + } +} +``` + + +### `onPullRequest` + +When activity occurs on a pull request (excluding reviews, issues, or comments). [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onPullRequest, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "action": "opened", + "number": 5, + "sender": { + "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" + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:38:34Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "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}" + }, + "pull_request": { + "id": 1402223044, + "url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5", + "base": { + "ref": "main", + "sha": "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "repo": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:38:34Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "allow_auto_merge": false, + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "merge_commit_title": "MERGE_MESSAGE", + "allow_update_branch": false, + "merge_commit_message": "PR_TITLE", + "delete_branch_on_merge": false, + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "squash_merge_commit_message": "COMMIT_MESSAGES", + "web_commit_signoff_required": false, + "use_squash_pr_title_as_default": false + }, + "user": { + "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" + }, + "label": "triggerdotdev:main" + }, + "body": "A bit more added to the readme which could be useful", + "head": { + "ref": "test", + "sha": "073aa42afebca03c4b34361564e3976da5c65d48", + "repo": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:38:34Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "allow_auto_merge": false, + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "merge_commit_title": "MERGE_MESSAGE", + "allow_update_branch": false, + "merge_commit_message": "PR_TITLE", + "delete_branch_on_merge": false, + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "squash_merge_commit_message": "COMMIT_MESSAGES", + "web_commit_signoff_required": false, + "use_squash_pr_title_as_default": false + }, + "user": { + "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" + }, + "label": "triggerdotdev:test" + }, + "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" + }, + "draft": false, + "state": "open", + "title": "Added more to the readme", + "_links": { + "html": { + "href": "https://github.com/triggerdotdev/empty/pull/5" + }, + "self": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5" + }, + "issue": { + "href": "https://api.github.com/repos/triggerdotdev/empty/issues/5" + }, + "commits": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits" + }, + "comments": { + "href": "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments" + }, + "statuses": { + "href": "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48" + }, + "review_comment": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments" + } + }, + "labels": [], + "locked": false, + "merged": false, + "number": 5, + "commits": 1, + "node_id": "PR_kwDOJyTwbc5TlDnE", + "assignee": null, + "comments": 0, + "diff_url": "https://github.com/triggerdotdev/empty/pull/5.diff", + "html_url": "https://github.com/triggerdotdev/empty/pull/5", + "additions": 2, + "assignees": [], + "closed_at": null, + "deletions": 0, + "issue_url": "https://api.github.com/repos/triggerdotdev/empty/issues/5", + "mergeable": null, + "merged_at": null, + "merged_by": null, + "milestone": null, + "patch_url": "https://github.com/triggerdotdev/empty/pull/5.patch", + "auto_merge": null, + "created_at": "2023-06-21T18:39:13Z", + "rebaseable": null, + "updated_at": "2023-06-21T18:39:13Z", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", + "changed_files": 1, + "mergeable_state": "unknown", + "requested_teams": [], + "review_comments": 0, + "merge_commit_sha": null, + "active_lock_reason": null, + "author_association": "MEMBER", + "review_comment_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", + "requested_reviewers": [], + "review_comments_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments", + "maintainer_can_modify": false + } +} +``` + + +### `onPullRequestReview` + +When a pull request review has activity. [Official GitHub docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_review). + +```ts usage.ts +client.defineJob({ + id: "", + name: "", + version: "0.1.0", + trigger: github.triggers.repo({ + event: events.onPullRequestReview, + owner: "", + repo: "", + }), + run: async (payload, io, ctx) => { + // Add tasks here + }, +}); +``` + + +```json +{ + "action": "submitted", + "review": { + "id": 1491475123, + "body": "This needs some work still", + "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": "commented", + "_links": { + "html": { + "href": "https://github.com/triggerdotdev/empty/pull/5#pullrequestreview-1491475123" + }, + "pull_request": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5" + } + }, + "node_id": "PRR_kwDOJyTwbc5Y5hqz", + "html_url": "https://github.com/triggerdotdev/empty/pull/5#pullrequestreview-1491475123", + "commit_id": "073aa42afebca03c4b34361564e3976da5c65d48", + "submitted_at": "2023-06-21T18:47:47Z", + "pull_request_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5", + "author_association": "MEMBER" + }, + "sender": { + "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" + }, + "repository": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:39:13Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "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}" + }, + "pull_request": { + "id": 1402223044, + "url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5", + "base": { + "ref": "main", + "sha": "1ca6a91f4a1385e448364a5de1960a3da60d3fe2", + "repo": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:39:13Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "allow_auto_merge": false, + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "merge_commit_title": "MERGE_MESSAGE", + "allow_update_branch": false, + "merge_commit_message": "PR_TITLE", + "delete_branch_on_merge": false, + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "squash_merge_commit_message": "COMMIT_MESSAGES", + "web_commit_signoff_required": false, + "use_squash_pr_title_as_default": false + }, + "user": { + "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" + }, + "label": "triggerdotdev:main" + }, + "body": "A bit more added to the readme which could be useful", + "head": { + "ref": "test", + "sha": "073aa42afebca03c4b34361564e3976da5c65d48", + "repo": { + "id": 656732269, + "url": "https://api.github.com/repos/triggerdotdev/empty", + "fork": false, + "name": "empty", + "size": 0, + "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/empty.git", + "license": null, + "node_id": "R_kgDOJyTwbQ", + "private": false, + "ssh_url": "git@github.com:triggerdotdev/empty.git", + "svn_url": "https://github.com/triggerdotdev/empty", + "archived": false, + "disabled": false, + "has_wiki": true, + "homepage": null, + "html_url": "https://github.com/triggerdotdev/empty", + "keys_url": "https://api.github.com/repos/triggerdotdev/empty/keys{/key_id}", + "language": null, + "tags_url": "https://api.github.com/repos/triggerdotdev/empty/tags", + "watchers": 0, + "blobs_url": "https://api.github.com/repos/triggerdotdev/empty/git/blobs{/sha}", + "clone_url": "https://github.com/triggerdotdev/empty.git", + "forks_url": "https://api.github.com/repos/triggerdotdev/empty/forks", + "full_name": "triggerdotdev/empty", + "has_pages": false, + "hooks_url": "https://api.github.com/repos/triggerdotdev/empty/hooks", + "pulls_url": "https://api.github.com/repos/triggerdotdev/empty/pulls{/number}", + "pushed_at": "2023-06-21T18:39:13Z", + "teams_url": "https://api.github.com/repos/triggerdotdev/empty/teams", + "trees_url": "https://api.github.com/repos/triggerdotdev/empty/git/trees{/sha}", + "created_at": "2023-06-21T14:21:07Z", + "events_url": "https://api.github.com/repos/triggerdotdev/empty/events", + "has_issues": true, + "issues_url": "https://api.github.com/repos/triggerdotdev/empty/issues{/number}", + "labels_url": "https://api.github.com/repos/triggerdotdev/empty/labels{/name}", + "merges_url": "https://api.github.com/repos/triggerdotdev/empty/merges", + "mirror_url": null, + "updated_at": "2023-06-21T17:23:26Z", + "visibility": "public", + "archive_url": "https://api.github.com/repos/triggerdotdev/empty/{archive_format}{/ref}", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/commits{/sha}", + "compare_url": "https://api.github.com/repos/triggerdotdev/empty/compare/{base}...{head}", + "description": "An empty repo that can be used to test the @trigger.dev/github integration", + "forks_count": 0, + "is_template": false, + "open_issues": 5, + "branches_url": "https://api.github.com/repos/triggerdotdev/empty/branches{/branch}", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/comments{/number}", + "contents_url": "https://api.github.com/repos/triggerdotdev/empty/contents/{+path}", + "git_refs_url": "https://api.github.com/repos/triggerdotdev/empty/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/triggerdotdev/empty/git/tags{/sha}", + "has_projects": true, + "releases_url": "https://api.github.com/repos/triggerdotdev/empty/releases{/id}", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/{sha}", + "allow_forking": true, + "assignees_url": "https://api.github.com/repos/triggerdotdev/empty/assignees{/user}", + "downloads_url": "https://api.github.com/repos/triggerdotdev/empty/downloads", + "has_downloads": true, + "languages_url": "https://api.github.com/repos/triggerdotdev/empty/languages", + "default_branch": "main", + "milestones_url": "https://api.github.com/repos/triggerdotdev/empty/milestones{/number}", + "stargazers_url": "https://api.github.com/repos/triggerdotdev/empty/stargazers", + "watchers_count": 0, + "deployments_url": "https://api.github.com/repos/triggerdotdev/empty/deployments", + "git_commits_url": "https://api.github.com/repos/triggerdotdev/empty/git/commits{/sha}", + "has_discussions": false, + "subscribers_url": "https://api.github.com/repos/triggerdotdev/empty/subscribers", + "allow_auto_merge": false, + "contributors_url": "https://api.github.com/repos/triggerdotdev/empty/contributors", + "issue_events_url": "https://api.github.com/repos/triggerdotdev/empty/issues/events{/number}", + "stargazers_count": 0, + "subscription_url": "https://api.github.com/repos/triggerdotdev/empty/subscription", + "collaborators_url": "https://api.github.com/repos/triggerdotdev/empty/collaborators{/collaborator}", + "issue_comment_url": "https://api.github.com/repos/triggerdotdev/empty/issues/comments{/number}", + "notifications_url": "https://api.github.com/repos/triggerdotdev/empty/notifications{?since,all,participating}", + "open_issues_count": 5, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "merge_commit_title": "MERGE_MESSAGE", + "allow_update_branch": false, + "merge_commit_message": "PR_TITLE", + "delete_branch_on_merge": false, + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "squash_merge_commit_message": "COMMIT_MESSAGES", + "web_commit_signoff_required": false, + "use_squash_pr_title_as_default": false + }, + "user": { + "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" + }, + "label": "triggerdotdev:test" + }, + "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" + }, + "draft": false, + "state": "open", + "title": "Added more to the readme", + "_links": { + "html": { + "href": "https://github.com/triggerdotdev/empty/pull/5" + }, + "self": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5" + }, + "issue": { + "href": "https://api.github.com/repos/triggerdotdev/empty/issues/5" + }, + "commits": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits" + }, + "comments": { + "href": "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments" + }, + "statuses": { + "href": "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48" + }, + "review_comment": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments" + } + }, + "labels": [], + "locked": false, + "number": 5, + "node_id": "PR_kwDOJyTwbc5TlDnE", + "assignee": null, + "diff_url": "https://github.com/triggerdotdev/empty/pull/5.diff", + "html_url": "https://github.com/triggerdotdev/empty/pull/5", + "assignees": [], + "closed_at": null, + "issue_url": "https://api.github.com/repos/triggerdotdev/empty/issues/5", + "merged_at": null, + "milestone": null, + "patch_url": "https://github.com/triggerdotdev/empty/pull/5.patch", + "auto_merge": null, + "created_at": "2023-06-21T18:39:13Z", + "updated_at": "2023-06-21T18:47:47Z", + "commits_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/commits", + "comments_url": "https://api.github.com/repos/triggerdotdev/empty/issues/5/comments", + "statuses_url": "https://api.github.com/repos/triggerdotdev/empty/statuses/073aa42afebca03c4b34361564e3976da5c65d48", + "requested_teams": [], + "merge_commit_sha": "f146c57c260778db17300c47c366bce0e2dbd53d", + "active_lock_reason": null, + "author_association": "MEMBER", + "review_comment_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/comments{/number}", + "requested_reviewers": [], + "review_comments_url": "https://api.github.com/repos/triggerdotdev/empty/pulls/5/comments" + } +} +``` + diff --git a/docs/integrations/apis/github.mdx b/docs/integrations/apis/github.mdx index c001d7da1..4b00021be 100644 --- a/docs/integrations/apis/github.mdx +++ b/docs/integrations/apis/github.mdx @@ -1,11 +1,21 @@ --- -title: "GitHub: Introduction" -sidebarTitle: "Introduction" +title: GitHub overview & authentication +sidebarTitle: Overview & authentication --- - +## Overview -## Installation +Our GitHub integration allows you to create triggers and tasks that interact with GitHub. For examples of some of the things you can do with it, check out our Jobs Showcase: + + + Check out pre-built GitHub jobs in our showcase. + + +## Installing the GitHub packages @@ -25,25 +35,41 @@ yarn add @trigger.dev/github@latest ## Authentication -GitHub supports Personal Access Tokens and OAuth. +GitHub supports Personal Access Tokens and OAuth. You can use either of these to authenticate with GitHub. -```ts -import { Github } from "@trigger.dev/github"; +### Personal Access Token + +To create a personal access token on GitHub, login and [follow the instructions](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). Information on the required scopes can be found [here](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps). + +```ts my-job.ts +import { GitHub } from "@trigger.dev/github"; //create GitHub client using a token -const github = new Github({ +const github = new GitHub({ id: "github", token: process.env.GITHUB_TOKEN!, }); +... +``` + +### OAuth + +To use OAuth you can connect to GitHub via the Trigger.dev [web app](https://cloud.trigger.dev). Click 'Integrations' in the side panel of any project, and configure GitHub with the ID you want to use in your job and the required [scopes](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps). + +```ts my-job.ts +import { GitHub } from "@trigger.dev/github"; //create GitHub client using OAuth -const github2 = new Github({ - id: "github2", +const github = new GitHub({ + id: "github", }); +... ``` ## Triggers and Tasks +Once you have set up a GitHub client, you can use it to create triggers and tasks. + Trigger Jobs when events happen in GitHub, such as a new commit or a new issue. @@ -52,51 +78,3 @@ const github2 = new Github({ Perform tasks such as creating a new issue or a new comment. - -## Using the underlying client - -You can use the underlying client to do anything Octokit supports. In this example we create a project card when a new issue is opened.. - - - View [the official GitHub docs](https://docs.github.com/en/rest) for everything that is - supported{" "} - - -```ts -import { Github, events } from "@trigger.dev/github"; - -const github = new Github({ - id: "github", - token: process.env.GITHUB_TOKEN!, -}); - -client.defineJob({ - id: "alert-on-new-github-issues", - name: "Alert on new GitHub issues", - version: "0.1.1", - trigger: github.triggers.repo({ - event: events.onIssueOpened, - owner: "triggerdotdev", - repo: "trigger.dev", - }), - integrations: { - github, - }, - run: async (payload, io, ctx) => { - //io.github.runTask allows you to use the underlying SDK client - const { data } = await io.github.runTask( - "create-card", - async (client) => { - return client.rest.projects.createCard({ - column_id: 123, - note: "test", - }); - }, - { name: "Create card" } - ); - - //log the url of the created card - await io.logger.info(data.url); - }, -}); -```