| title | GitHub overview & authentication |
|---|---|
| sidebarTitle | Overview & authentication |
Our GitHub integration allows you to create triggers and tasks that interact with GitHub. Trigger jobs when events happen, like when a new issue is added to a repo, or when a pull request is opened, etc. You can also perform tasks like creating issues, getting information about a repo, adding comments, and much more.
To get started with our GitHub integration, you need to install the @trigger.dev/github packages. You can do this using npm, pnpm, or yarn:
npm install @trigger.dev/github@latestpnpm install @trigger.dev/github@latestyarn add @trigger.dev/github@latestGitHub supports Personal Access Tokens and OAuth. You can use either of these to authenticate with GitHub.
To create a personal access token on GitHub, login and follow the instructions. Information on the required scopes can be found here.
import { GitHub } from "@trigger.dev/github";
//create GitHub client using a token
const github = new GitHub({
id: "github",
token: process.env.GITHUB_TOKEN!,
});
...To use OAuth you can connect to GitHub via the Trigger.dev web app. 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.
import { GitHub } from "@trigger.dev/github";
//create GitHub client using OAuth
const github = new GitHub({
id: "github",
});
...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. Perform tasks such as creating a new issue or a new comment. Check out pre-built jobs using GitHub in our API section.