github
Platypush documentation
github
- class platypush.backend.github.GithubBackend(user: str, user_token: str, repos: Optional[List[str]] = None, org: Optional[str] = None, poll_seconds: int = 60, max_events_per_scan: Optional[int] = 10, *args, **kwargs)[source]
Bases:
Backend
This backend monitors for notifications and events either on Github user, organization or repository level. You’ll need a Github personal access token to use the service. To get one:
Access your Github profile settings
Select Developer Settings
Select Personal access tokens
Click Generate new token
This backend requires the following permissions:
repo
notifications
read:org
if you want to access repositories on organization level.
Triggers:
platypush.message.event.github.GithubPushEvent
when a new push is created.platypush.message.event.github.GithubCommitCommentEvent
when a new commit comment is created.platypush.message.event.github.GithubCreateEvent
when a tag or branch is created.platypush.message.event.github.GithubDeleteEvent
when a tag or branch is deleted.platypush.message.event.github.GithubForkEvent
when a user forks a repository.platypush.message.event.github.GithubWikiEvent
when new activity happens on a repository wiki.platypush.message.event.github.GithubIssueCommentEvent
when new activity happens on an issue comment.platypush.message.event.github.GithubIssueEvent
when new repository issue activity happens.platypush.message.event.github.GithubMemberEvent
when new repository collaborators activity happens.platypush.message.event.github.GithubPublicEvent
when a repository goes public.platypush.message.event.github.GithubPullRequestEvent
when new pull request related activity happens.platypush.message.event.github.GithubPullRequestReviewCommentEvent
when activity happens on a pullrequest commit.
platypush.message.event.github.GithubReleaseEvent
when a new release happens.platypush.message.event.github.GithubSponsorshipEvent
when new sponsorship related activity happens.platypush.message.event.github.GithubWatchEvent
when someone stars/starts watching a repository.platypush.message.event.github.GithubEvent
for any event that doesn’t fall in the above categories(
event_type
will be set accordingly).
- __init__(user: str, user_token: str, repos: Optional[List[str]] = None, org: Optional[str] = None, poll_seconds: int = 60, max_events_per_scan: Optional[int] = 10, *args, **kwargs)[source]
If neither
repos
nororg
is specified then the backend will monitor all new events on user level.- Parameters:
user – Github username.
user_token – Github personal access token.
repos – List of repos to be monitored - if a list is provided then only these repositories will be monitored for events. Repositories should be passed in the format
username/repository
.org – Organization to be monitored - if provided then only this organization will be monitored for events.
poll_seconds – How often the backend should check for new events, in seconds (default: 60).
max_events_per_scan – Maximum number of events per resource that will be triggered if there is a large number of events/notification since the last check (default: 10). Specify 0 or null for no limit.
- class platypush.backend.github.GithubResource(**kwargs)[source]
Bases:
Base
Models the GithubLastEvent table, containing the timestamp where a certain URL was last checked.
- __init__(**kwargs)
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.