Webhooks
New Star Event
Webhooks
New Star Event
Trigger a workflow whenever a user star's the specified GitHub repository.
Usage
import * as github from "@trigger.dev/github";
new Trigger({
id: "demo",
on: github.events.newStarEvent({
repo: "triggerdotdev/trigger.dev",
}),
run: async (event, ctx) => {},
}).listen();
Params
reporequired
string
The full path to the repository, including the organization
Event
actionDefault: "created"
string
The star action, which in this case is always "created"
.
starred_atrequired
Date
The date and time the starring occurred.
repositoryrequired
object
A repository on GitHub.
senderrequired
object
The GitHub user object who starred the repository.
organization
object
The organization object the repository belongs to.
Example Workflows
import * as slack from "@trigger.dev/slack";
new Trigger({
id: "new-star",
name: "On New Star",
on: github.events.newStarEvent({
repo: "triggerdotdev/trigger.dev",
}),
run: async (event, ctx) => {
await slack.postMessage("⭐️ New Star", {
channelName: "github-stars",
text: `Repo ${event.repository.full_name} got a star from ${event.sender.login}, for a total of ${event.repository.stargazers_count} stars!`,
});
},
}).listen();
Example Event payload
Example
{
"action": "created",
"starred_at": "2023-01-21T23:47:38Z",
"repository": {
"id": 516315865,
"node_id": "R_kgDOHsZa2Q",
"name": "apihero-openapi-generator",
"full_name": "triggerdotdev/apihero-openapi-generator",
"private": false,
"owner": {
"login": "triggerdotdev",
"id": 95297378,
"node_id": "O_kgDOBa4fYg",
"avatar_url": "https://avatars.githubusercontent.com/u/95297378?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/triggerdotdev",
"html_url": "https://github.com/triggerdotdev",
"followers_url": "https://api.github.com/users/triggerdotdev/followers",
"following_url": "https://api.github.com/users/triggerdotdev/following{/other_user}",
"gists_url": "https://api.github.com/users/triggerdotdev/gists{/gist_id}",
"starred_url": "https://api.github.com/users/triggerdotdev/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/triggerdotdev/subscriptions",
"organizations_url": "https://api.github.com/users/triggerdotdev/orgs",
"repos_url": "https://api.github.com/users/triggerdotdev/repos",
"events_url": "https://api.github.com/users/triggerdotdev/events{/privacy}",
"received_events_url": "https://api.github.com/users/triggerdotdev/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/triggerdotdev/apihero-openapi-generator",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator",
"forks_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/forks",
"keys_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/teams",
"hooks_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/hooks",
"issue_events_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/issues/events{/number}",
"events_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/events",
"assignees_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/assignees{/user}",
"branches_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/branches{/branch}",
"tags_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/tags",
"blobs_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/statuses/{sha}",
"languages_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/languages",
"stargazers_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/stargazers",
"contributors_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/contributors",
"subscribers_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/subscribers",
"subscription_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/subscription",
"commits_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/contents/{+path}",
"compare_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/merges",
"archive_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/downloads",
"issues_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/issues{/number}",
"pulls_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/pulls{/number}",
"milestones_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/milestones{/number}",
"notifications_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/labels{/name}",
"releases_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/releases{/id}",
"deployments_url": "https://api.github.com/repos/triggerdotdev/apihero-openapi-generator/deployments",
"created_at": "2022-07-21T09:57:53Z",
"updated_at": "2023-01-21T23:47:38Z",
"pushed_at": "2022-10-20T13:21:09Z",
"git_url": "git://github.com/triggerdotdev/apihero-openapi-generator.git",
"ssh_url": "git@github.com:triggerdotdev/apihero-openapi-generator.git",
"clone_url": "https://github.com/triggerdotdev/apihero-openapi-generator.git",
"svn_url": "https://github.com/triggerdotdev/apihero-openapi-generator",
"homepage": null,
"size": 4962,
"stargazers_count": 1,
"watchers_count": 1,
"language": "TypeScript",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 1,
"default_branch": "main"
},
"organization": {
"login": "triggerdotdev",
"id": 95297378,
"node_id": "O_kgDOBa4fYg",
"url": "https://api.github.com/orgs/triggerdotdev",
"repos_url": "https://api.github.com/orgs/triggerdotdev/repos",
"events_url": "https://api.github.com/orgs/triggerdotdev/events",
"hooks_url": "https://api.github.com/orgs/triggerdotdev/hooks",
"issues_url": "https://api.github.com/orgs/triggerdotdev/issues",
"members_url": "https://api.github.com/orgs/triggerdotdev/members{/member}",
"public_members_url": "https://api.github.com/orgs/triggerdotdev/public_members{/member}",
"avatar_url": "https://avatars.githubusercontent.com/u/95297378?v=4",
"description": ""
},
"sender": {
"login": "ericallam",
"id": 534,
"node_id": "MDQ6VXNlcjUzNA==",
"avatar_url": "https://avatars.githubusercontent.com/u/534?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ericallam",
"html_url": "https://github.com/ericallam",
"followers_url": "https://api.github.com/users/ericallam/followers",
"following_url": "https://api.github.com/users/ericallam/following{/other_user}",
"gists_url": "https://api.github.com/users/ericallam/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ericallam/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ericallam/subscriptions",
"organizations_url": "https://api.github.com/users/ericallam/orgs",
"repos_url": "https://api.github.com/users/ericallam/repos",
"events_url": "https://api.github.com/users/ericallam/events{/privacy}",
"received_events_url": "https://api.github.com/users/ericallam/received_events",
"type": "User",
"site_admin": false
}
}