Back to jobs
Trigger: eventTrigger
When a new GitHub issue is opened add a “Bug” label to it.
Integrations:
/src/githubNewIssueOpened
Dev Ops
1import { TriggerClient } from "@trigger.dev/sdk";2import { Github, events } from "@trigger.dev/github";34const client = new TriggerClient({ id: "jobs-showcase" });56const github = new Github({ id: "github" });78// This Job will run when a new issue is opened on a repo you have admin rights to9// Once created, it will add a 'Bug' label to the issue10client.defineJob({11id: "github-new-issue-opened",12name: "GitHub: new issue opened",13version: "1.0.0",14integrations: { github: github },15trigger: github.triggers.repo({16event: events.onIssueOpened,17owner: "<your-org-name>",18repo: "<your-repo-name>",19}),20run: async (payload, io, ctx) => {21await io.github.addIssueLabels("add label", {22owner: payload.repository.owner.login,23repo: payload.repository.name,24issueNumber: payload.issue.number,25labels: ["bug"],26});27return { payload, ctx };28},29});3031// These lines can be removed if you don't want to use express32import { createExpressServer } from "@trigger.dev/express";33createExpressServer(client);