When a GitHub issue is created or modified, post a message and link to the issue in a specific Slack channel.
Integrations
Help and guides
Get started
Run this command in your terminal to create a new project using this template.
When a GitHub issue is created or modified, post a message and link to the issue in a specific Slack channel.
Integrations
Help and guides
Get started
Run this command in your terminal to create a new project using this template.
This template contains a GitHub IssueEvent Trigger that will run whenever an issue action is performed in a GitHub repository:
import { Trigger } from "@trigger.dev/sdk";
import * as github from "@trigger.dev/github";
import * as slack from "@trigger.dev/slack";
// Change "triggerdotdev/github-issues-to-slack" to the repo you want to track e.g. "yourorg/yourrepo"
//NB: GitHub org / usernames are case sensitive.
const repo =
process.env.GITHUB_REPOSITORY ?? "triggerdotdev/github-issues-to-slack";
new Trigger({
// Give your Trigger a stable ID
id: "github-issues-to-slack",
name: "Posts to Slack when a GitHub Issue is created or modified",
// This will register a webhook with the repo
// and trigger whenever a new issue is created or modified
on: github.events.issueEvent({
repo,
}),
// The run function will get called once per "issue" event
// See https://docs.trigger.dev/integrations/apis/github/events/issues
run: async (event, ctx) => {
// Posts a new message to the "github-issues" slack channel.
// See https://docs.trigger.dev/integrations/apis/slack/actions/post-message
// If the channel is private, you'll need to add the Trigger.dev bot to the channel first.
const response = await slack.postMessage("send-to-slack", {
channelName: "github-issues",
// If you include blocks, this text will be used in any notifications.
text: `GitHub issue, *${event.issue.title}* has been *${event.action}*. `,
// Blocks allow you to create richly formatted messages.
// See https://api.slack.com/tools/block-kit-builder
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: `GitHub issue, *${event.issue.title}* has been *${event.action}*.`,
},
accessory: {
type: "button",
text: {
type: "plain_text",
text: "View Issue",
emoji: true,
},
value: "View Issue",
url: event.issue.html_url,
action_id: "button-action",
},
},
],
});
},
}).listen();
repo
parameter to point to a GitHub repository you manage by setting the GITHUB_REPOSITORY
environment variable.You can also do this with comments , pull requests, and more.