id: "alert-on-new-github-issues",
  name: "Alert on new GitHub issues",
  version: "1.0.0",
  trigger: github.triggers.repo({
    event: events.onIssueOpened,
    owner: "triggerdotdev",
    repo: "",
  run: async (payload, io, ctx) => {
    const record = await io.runTask(
      async (task) => {
        return prisma.githubIssues.create({
          data: {
            number: payload.issue.number,
            title: payload.issue.title,
            body: payload.issue.body,
            url: payload.issue.html_url,
            repo: payload.repository.full_name,
            owner: payload.repository.owner.login,
      //this is optional
      { name: "Sync GitHub Issue", icon: "github" }

A Task is a cached unit of work in a Job Run that are logged to the UI. You can use io.runTask() to create and run a Task inside a Run.

Any interaction with an external service (database or API) should be wrapped in a Task. Failing to do so could result in repeated work when runs are resumed.



Should be a stable and unique cache key inside the run(). See resumability for more information.


The callback that will be called when the Task is run, this is where your logic should go. The callback receives the Task and the IO as parameters.


The options of how you’d like to run and log the Task.


An optional callback that will be called when the Task fails. You can perform logic in here and optionally return a custom error object. Returning an object with { retryAt: Date, error?: Error } will retry the Task at the specified Date. You can also just return a new Error object to throw a new error. Returning null or undefined will rethrow the original error. If you want to force retrying to be skipped, return { skipRetrying: true }.


A Promise that resolves with the returned value of the callback.

If the remote callback feature options.callback is enabled, the Promise will instead resolve with the body of the first request sent to task.callbackUrl.