github

package
v0.0.0-...-3af5e67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWatching

func StartWatching()

StartWatching is a helper function that will call all events allowing then to subscribe then to their related event

func StartWatchingGithubReleases

func StartWatchingGithubReleases()

StartWatchingGithubReleases subscribes to the GitHub release event channel

func WebhookListener

func WebhookListener(rw http.ResponseWriter, req *http.Request, ps httprouter.Params)

WebhookListener is the endpoint for which the GitHub webhook events should be sent It checks if we support the sent event and handles it accordingly

Types

type Owner

type Owner struct {
	AvatarURL string `json:"avatar_url"`
}

Owner is the data related to the GitHub repository owner, can be a user or and organisation

type Release

type Release struct {
	ID          int       `json:"id"`
	URL         string    `json:"url"`
	HTMLURL     string    `json:"html_url"`
	AssetsURL   string    `json:"assets_url"`
	UploadURL   string    `json:"upload_url"`
	TarballURL  string    `json:"tarball_url"`
	ZipballURL  string    `json:"zipball_url"`
	NodeID      string    `json:"node_id"`
	TagName     string    `json:"tag_name"`
	Branch      string    `json:"target_commitish"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	CreatedAt   time.Time `json:"created_at"`
	PublishedAt time.Time `json:"published_at"`
}

Release is the data sent when the event of the payload is a repository release

type Repository

type Repository struct {
	Name        string `json:"name"`
	FullName    string `json:"full_name"`
	Owner       Owner  `json:"owner"`
	HTMLURL     string `json:"html_url"`
	Description string `json:"description"`
}

Repository is the data related to a GitHub repository

type Sender

type Sender struct {
	Username  string `json:"login"`
	AvatarURL string `json:"avatar_url"`
}

Sender is the data related to the GitHub event creator, can be a user or a bot

type Webhook

type Webhook struct {
	Action     string     `json:"action"`
	Release    Release    `json:"release"`
	Repository Repository `json:"repository"`
	Sender     Sender     `json:"sender"`
	ChannelID  string     `json:"-"`
}

Webhook is the payload GitHub sends on a webhook event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL