Choose a different Template

Post to Slack every time a GitHub repo is starred

When a GitHub repo is starred, post information about the user to Slack.



Help and guides

Get started

Run this command in your terminal to create a new project using this template.

npx create-trigger github-stars-to-slack

This template contains a GitHub newStarEvent Trigger that will run whenever the specified repository gets a new ⭐️:

import { Trigger } from "";
import * as github from "";
import * as slack from "";

// Change "triggerdotdev/github-stars-to-slack" to the repo you want to track e.g. "yourorg/yourrepo"
const repo =
  process.env.GITHUB_REPOSITORY ?? "triggerdotdev/github-stars-to-slack";

new Trigger({
  // Give your Trigger a stable ID
  id: "github-stars-to-slack",
  name: "GitHub Stars to Slack",
  // This will register a webhook with the repo
  // and trigger whenever the repo gets a new star
  // The run function will get called once per "new star" event
  // See
  run: async (event) => {
    // Posts a new message to the "github-stars" slack channel.
    // See
    await slack.postMessage("⭐️", {
      channelName: "github-stars",
      text: `New GitHub star from \n<${event.sender.html_url}|${event.sender.login}>. You now have ${event.repository.stargazers_count} stars!`,

✍️ Customize

  1. Make sure and update the repo parameter to point to a GitHub repository you manage by setting the GITHUB_REPOSITORY environment variable.
  2. Feel free to customize postMessage call with more data from the newStar Event and change the channel name.