Documentation
¶
Overview ¶
Package github is a small subset wrapper for the GitHub API. See https://docs.github.com/en/rest?apiVersion=2022-11-28
Index ¶
- Constants
- func KnownSshKeys(client *http.Client) (string, error)
- func NewRequest(uri, method, token string) (*http.Request, error)
- type Anchor
- type Arthor
- type Asset
- type Author
- type Client
- func (gh *Client) DoesBranchExistRemotely(branch string) bool
- func (gh *Client) MergePullRequest(prNumber int, mergeMethod string) (*PullRequestMergeResponse, error)
- func (gh *Client) OpenPullRequest(base, branch, title, summary string) (*PullRequest, error)
- func (gh *Client) PublishChangelog(wd, branch, header, msgBody string, files []string) error
- func (gh *Client) Send(uri, method string, body io.Reader) (*http.Response, error)
- func (gh *Client) TagAndRelease(branch, tag string) (*ReleasesResponse, error)
- type Commit
- type CommitDetail
- type HttpClient
- type Label
- type License
- type Link
- type Links
- type Meta
- type Milestone
- type ParentCommit
- type Permissions
- type Profile
- type Protection
- type PullRequest
- type PullRequestBody
- type PullRequestMergeBody
- type PullRequestMergeResponse
- type Ref
- type Release
- type ReleasesResponse
- type Repo
- type RequiredStatusChecks
- type ResponseBranch
- type Team
- type Tree
- type Uploader
- type Verification
Constants ¶
View Source
const ( BaseUri = "https://%s/repos/%s/%s" GenBranchName = "auto-update-changelog" )
View Source
const ( EnvMergeType = "PARAM_MERGE_TYPE" EnvToken = "GH_TOKEN" EnvServer = "PARAM_GH_SERVER" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arthor ¶
type Arthor struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` }
type Asset ¶
type Asset struct { Url string `json:"url"` BrowserDownloadUrl string `json:"browser_download_url"` Id int `json:"id"` NodeId string `json:"node_id"` Name string `json:"name"` Label string `json:"label"` State string `json:"state"` ContentType string `json:"content_type"` Size int `json:"size"` DownloadCount int `json:"download_count"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Uploader Uploader `json:"uploader"` }
type Client ¶
type Client struct { Client HttpClient Domain string MergeMethod string Org string RepositoryUri string Repository string Token string Username string Host string }
func NewClient ¶
func NewClient(repositoryUri, token, host string, client HttpClient) *Client
func (*Client) DoesBranchExistRemotely ¶
func (*Client) MergePullRequest ¶
func (gh *Client) MergePullRequest(prNumber int, mergeMethod string) (*PullRequestMergeResponse, error)
MergePullRequest Merge a pull request.
func (*Client) OpenPullRequest ¶
func (gh *Client) OpenPullRequest(base, branch, title, summary string) (*PullRequest, error)
OpenPullRequest Opens a pull request against the base branch. gh pr create --base "${PARAM_MAIN_TRUNK_BRANCH}" --head "${GEN_BRANCH_NAME}" --fill
func (*Client) PublishChangelog ¶
PublishChangelog Stage, commit, and push local changes, then make a pull request and merge it containing: 1. the git-chglog command config files if they are missing or first run. 2. the CHANGELOG.md if it contains changes.
func (*Client) TagAndRelease ¶
func (gh *Client) TagAndRelease(branch, tag string) (*ReleasesResponse, error)
type CommitDetail ¶
type CommitDetail struct { Sha string `json:"sha"` NodeId string `json:"node_id"` Commit Commit `json:"commit"` Url string `json:"url"` HtmlUrl string `json:"html_url"` CommentsUrl string `json:"comments_url"` Author Profile `json:"author"` Committer Profile `json:"committer"` Parents []ParentCommit `json:"parents"` }
type Milestone ¶
type Milestone struct { Url string `json:"url"` HtmlUrl string `json:"html_url"` LabelsUrl string `json:"labels_url"` Id int `json:"id"` NodeId string `json:"node_id"` Number int `json:"number"` State string `json:"state"` Title string `json:"title"` Description string `json:"description"` Creator Profile `json:"creator"` OpenIssues int `json:"open_issues"` ClosedIssues int `json:"closed_issues"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ClosedAt time.Time `json:"closed_at"` DueOn time.Time `json:"due_on"` }
type ParentCommit ¶
type Permissions ¶
type Profile ¶
type Profile struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` }
type Protection ¶
type Protection struct { Enabled bool `json:"enabled"` RequiredStatusChecks RequiredStatusChecks `json:"required_status_checks"` }
type PullRequest ¶
type PullRequest struct { Url string `json:"url"` Id int `json:"id"` NodeId string `json:"node_id"` HtmlUrl string `json:"html_url"` DiffUrl string `json:"diff_url"` PatchUrl string `json:"patch_url"` IssueUrl string `json:"issue_url"` CommitsUrl string `json:"commits_url"` ReviewCommentsUrl string `json:"review_comments_url"` ReviewCommentUrl string `json:"review_comment_url"` CommentsUrl string `json:"comments_url"` StatusesUrl string `json:"statuses_url"` Number int `json:"number"` State string `json:"state"` Locked bool `json:"locked"` Title string `json:"title"` User Profile `json:"user"` Body string `json:"body"` Labels []Label `json:"labels"` Milestone Milestone `json:"milestone"` ActiveLockReason string `json:"active_lock_reason"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ClosedAt time.Time `json:"closed_at"` MergedAt time.Time `json:"merged_at"` MergeCommitSha string `json:"merge_commit_sha"` Assignee Profile `json:"assignee"` Assignees []Profile `json:"assignees"` RequestedReviewers []Profile `json:"requested_reviewers"` RequestedTeams []Team `json:"requested_teams"` Head Ref `json:"head"` Base Ref `json:"base"` Links Links `json:"_links"` AuthorAssociation string `json:"author_association"` AutoMerge interface{} `json:"auto_merge"` Draft bool `json:"draft"` Merged bool `json:"merged"` Mergeable bool `json:"mergeable"` Rebaseable bool `json:"rebaseable"` MergeableState string `json:"mergeable_state"` MergedBy Profile `json:"merged_by"` Comments int `json:"comments"` ReviewComments int `json:"review_comments"` MaintainerCanModify bool `json:"maintainer_can_modify"` Commits int `json:"commits"` Additions int `json:"additions"` Deletions int `json:"deletions"` ChangedFiles int `json:"changed_files"` }
type PullRequestBody ¶
type PullRequestMergeBody ¶
type ReleasesResponse ¶
type ReleasesResponse struct { 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"` DiscussionUrl string `json:"discussion_url"` Id int `json:"id"` NodeId string `json:"node_id"` TagName string `json:"tag_name"` TargetCommitish 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"` Author Arthor `json:"author"` Assets []Asset `json:"assets"` }
type Repo ¶
type Repo struct { Id int `json:"id"` NodeId string `json:"node_id"` Name string `json:"name"` FullName string `json:"full_name"` Owner Profile `json:"owner"` Private bool `json:"private"` HtmlUrl string `json:"html_url"` Description string `json:"description"` Fork bool `json:"fork"` Url string `json:"url"` ArchiveUrl string `json:"archive_url"` AssigneesUrl string `json:"assignees_url"` BlobsUrl string `json:"blobs_url"` BranchesUrl string `json:"branches_url"` CollaboratorsUrl string `json:"collaborators_url"` CommentsUrl string `json:"comments_url"` CommitsUrl string `json:"commits_url"` CompareUrl string `json:"compare_url"` ContentsUrl string `json:"contents_url"` ContributorsUrl string `json:"contributors_url"` DeploymentsUrl string `json:"deployments_url"` DownloadsUrl string `json:"downloads_url"` EventsUrl string `json:"events_url"` ForksUrl string `json:"forks_url"` GitCommitsUrl string `json:"git_commits_url"` GitRefsUrl string `json:"git_refs_url"` GitTagsUrl string `json:"git_tags_url"` GitUrl string `json:"git_url"` IssueCommentUrl string `json:"issue_comment_url"` IssueEventsUrl string `json:"issue_events_url"` IssuesUrl string `json:"issues_url"` KeysUrl string `json:"keys_url"` LabelsUrl string `json:"labels_url"` LanguagesUrl string `json:"languages_url"` MergesUrl string `json:"merges_url"` MilestonesUrl string `json:"milestones_url"` NotificationsUrl string `json:"notifications_url"` PullsUrl string `json:"pulls_url"` ReleasesUrl string `json:"releases_url"` SshUrl string `json:"ssh_url"` StargazersUrl string `json:"stargazers_url"` StatusesUrl string `json:"statuses_url"` SubscribersUrl string `json:"subscribers_url"` SubscriptionUrl string `json:"subscription_url"` TagsUrl string `json:"tags_url"` TeamsUrl string `json:"teams_url"` TreesUrl string `json:"trees_url"` CloneUrl string `json:"clone_url"` MirrorUrl string `json:"mirror_url"` HooksUrl string `json:"hooks_url"` SvnUrl string `json:"svn_url"` Homepage string `json:"homepage"` Language interface{} `json:"language"` ForksCount int `json:"forks_count"` StargazersCount int `json:"stargazers_count"` WatchersCount int `json:"watchers_count"` Size int `json:"size"` DefaultBranch string `json:"default_branch"` OpenIssuesCount int `json:"open_issues_count"` Topics []string `json:"topics"` HasIssues bool `json:"has_issues"` HasProjects bool `json:"has_projects"` HasWiki bool `json:"has_wiki"` HasPages bool `json:"has_pages"` HasDownloads bool `json:"has_downloads"` HasDiscussions bool `json:"has_discussions"` Archived bool `json:"archived"` Disabled bool `json:"disabled"` PushedAt time.Time `json:"pushed_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Permissions Permissions `json:"permissions"` AllowRebaseMerge bool `json:"allow_rebase_merge"` TempCloneToken string `json:"temp_clone_token"` AllowSquashMerge bool `json:"allow_squash_merge"` AllowMergeCommit bool `json:"allow_merge_commit"` AllowForking bool `json:"allow_forking"` Forks int `json:"forks"` OpenIssues int `json:"open_issues"` License License `json:"license"` Watchers int `json:"watchers"` }
type RequiredStatusChecks ¶
type RequiredStatusChecks struct { EnforcementLevel string `json:"enforcement_level"` Contexts []interface{} `json:"contexts"` Checks []interface{} `json:"checks"` }
type ResponseBranch ¶
type ResponseBranch struct { Name string `json:"name"` Commit CommitDetail `json:"commit"` Links Link `json:"_links"` Protected bool `json:"protected"` Protection Protection `json:"protection"` ProtectionUrl string `json:"protection_url"` }
type Team ¶
type Team struct { Id int `json:"id"` NodeId string `json:"node_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Privacy string `json:"privacy"` NotificationSetting string `json:"notification_setting"` Permission string `json:"permission"` MembersUrl string `json:"members_url"` RepositoriesUrl string `json:"repositories_url"` }
type Uploader ¶
type Uploader struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` AvatarUrl string `json:"avatar_url"` GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` }
type Verification ¶
Click to show internal directories.
Click to hide internal directories.