Back to APIs

Subscribe to webhooks and automate tasks in your code repositories.

Using our official GitHub integration

Easily subscribe to GitHub webhooks to trigger your jobs.

Create any tasks possible with the GitHub API.

Use io.runTask() and the official SDK or fetch.

GitHub integration docs

Example code using GitHub

Below are some working code examples of how you can use GitHub with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

1
import { TriggerClient } from "@trigger.dev/sdk";
2
import { Github, events } from "@trigger.dev/github";
3
4
const github = new Github({ id: "github" });
5
6
// This Job will run when a new issue is opened on a repo you have admin rights to
7
// Once created, it will add a 'Bug' label to the issue
8
client.defineJob({
9
id: "github-new-issue-opened",
10
name: "GitHub: new issue opened",
11
version: "1.0.0",
12
integrations: { github: github },
13
trigger: github.triggers.repo({
14
event: events.onIssueOpened,
15
owner: "<your-org-name>",
16
repo: "<your-repo-name>",
17
}),
18
run: async (payload, io, ctx) => {
19
await io.github.addIssueLabels("add label", {
20
owner: payload.repository.owner.login,
21
repo: payload.repository.name,
22
issueNumber: payload.issue.number,
23
labels: ["bug"],
24
});
25
return { payload, ctx };
26
},
27
});

Full-stack GitHub example projects