GitHub subscriptions
OneGraph offers event-based subscriptions for repo-centered events on GitHub.
The following example will subscribe to new issue comments:
subscription GitHubIssueComments($repoOwner: String!, $repoName: String!) {
github {
issueCommentEvent(input: {repoOwner: $repoOwner, repoName: $repoName}) {
action
comment {
author {
... on GitHubUser {
name
}
}
body
}
}
}
}
By default, you must be an admin on a GitHub repo to create subscriptions.
If you would like to allow non-admins to create subscriptions, go to Subscriptions > GitHub subscriptions
in the OneGraph dashboard. From there, you can add the repositories that non-admins can create subscriptions for. You will have to be an admin on the repo to add a repository.
OneGraph will ensure that the GitHub user has read access to the repository before allowing them to subscribe to an event and before delivering any subscription payloads. If they lose access to the repo, then they will receive graphql error payloads when new events occur until they gain access or unsubscribe.