Documentation
¶
Index ¶
- Variables
- func AppendToGHActionsSummary(summary string)
- func CallGithubAPI(token string, method string, path string, data interface{}) (string, error)
- func CommitAndPush(repo GitHubRepo, commit GitCommit)
- func GenerateInstallationAccessToken(token string, installationId int) (string, error)
- func GenerateToken(privatePem []byte) (string, error)
- func GetModifiedAndNewFiles() ([]string, error)
- func GetModifiedFiles() ([]string, error)
- func GetModifiedFilesFromGitDiff(fromStaged bool) ([]string, error)
- func IsGitHubActions() bool
- func SendToGHActionsOutput(variable string, output string)
- func SetGithubAppToken(token *GitHubAppToken)
- func SignJWTAppToken(privatePem []byte)
- func SignJWTAppTokenWithFilename(pemFilename string)
- func StageModifiedAndNewFiles() error
- func StageModifiedFiles() error
- type CommitOptions
- type CommitParent
- type CommitVerification
- type FileInfo
- type GitCommit
- type GitFile
- type GitHubAppToken
- type GitHubOrg
- type GitHubRepo
- type GitHubUser
- type GitUser
- type GithubAccount
- type GithubAppInstallationResponse
- type GithubBlobRequest
- type GithubBlobResponse
- type GithubCommitRequest
- type GithubCommitResponse
- type GithubRefRequest
- type GithubRefResponse
- type GithubTreeRequest
- type GithubTreeResponse
- type Permissions
- type RefObject
- type TokenInfo
- type TreeItem
Constants ¶
This section is empty.
Variables ¶
View Source
var (
TOKEN_TTL = int64(5)
)
Functions ¶
func AppendToGHActionsSummary ¶
func AppendToGHActionsSummary(summary string)
func CallGithubAPI ¶
func CommitAndPush ¶
func CommitAndPush(repo GitHubRepo, commit GitCommit)
func GetModifiedAndNewFiles ¶
func GetModifiedFiles ¶
func IsGitHubActions ¶
func IsGitHubActions() bool
func SendToGHActionsOutput ¶
func SetGithubAppToken ¶
func SetGithubAppToken(token *GitHubAppToken)
func SignJWTAppToken ¶
func SignJWTAppToken(privatePem []byte)
func SignJWTAppTokenWithFilename ¶
func SignJWTAppTokenWithFilename(pemFilename string)
func StageModifiedAndNewFiles ¶
func StageModifiedAndNewFiles() error
func StageModifiedFiles ¶
func StageModifiedFiles() error
Types ¶
type CommitOptions ¶
type CommitParent ¶
type CommitVerification ¶
type FileInfo ¶
type GitCommit ¶
type GitCommit struct {
HeadBranch *string
Branch string
OnBehalfOf *GitHubOrg
Message string
Options CommitOptions
}
type GitFile ¶
func UploadFilesToGitHubBlob ¶
type GitHubAppToken ¶
type GitHubAppToken struct {
Repo GitHubRepo `json:"repo"`
Token string `json:"token"`
}
func GenerateInstallationAppToken ¶
func GenerateInstallationAppToken(repo GitHubRepo) GitHubAppToken
type GitHubRepo ¶
type GitHubUser ¶
type GithubAccount ¶
type GithubAccount 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 GithubAppInstallationResponse ¶
type GithubAppInstallationResponse struct {
Id int `json:"id"`
Account GithubAccount `json:"account"`
RepositorySelection string `json:"repository_selection"`
AccessTokenUrl string `json:"access_tokens_url"`
HtmlUrl string `json:"html_url"`
AppId int `json:"app_id"`
TargetId int `json:"target_id"`
TargetType string `json:"target_type"`
Permissions Permissions `json:"permissions"`
Events []string `json:"events"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SingleFileName string `json:"single_file_name"`
HasMultipleSingleFiles bool `json:"has_multiple_single_files"`
SingleFilePaths []string `json:"single_file_paths"`
AppSlug string `json:"app_slug"`
SuspendedAt *time.Time `json:"suspended_at"`
SuspendedBy *string `json:"suspended_by"`
}
func GetAppInstallationDetails ¶
func GetAppInstallationDetails(jwt string, repo GitHubRepo) (GithubAppInstallationResponse, error)
type GithubBlobRequest ¶
type GithubBlobResponse ¶
type GithubBlobResponse struct {
Url string `json:"url"` // ulr of the blob
Sha string `json:"sha"` // sha of the blob
}
func CreateBlob ¶
func CreateBlob(blob GithubBlobRequest) (GithubBlobResponse, error)
func UploadFileToGitHubBlob ¶
func UploadFileToGitHubBlob(filename string) (GithubBlobResponse, error)
type GithubCommitRequest ¶
type GithubCommitResponse ¶
type GithubCommitResponse struct {
Sha string `json:"sha"`
NodeId string `json:"node_id"`
Url string `json:"url"`
Author GitHubUser `json:"author"`
Committer GitHubUser `json:"committer"`
Message string `json:"message"`
Tree TreeItem `json:"tree"`
Parents []CommitParent `json:"parents"`
Verification CommitVerification `json:"verification"`
HtmlUrl string `json:"html_url"`
}
func CreateCommit ¶
func CreateCommit(commit GithubCommitRequest) (GithubCommitResponse, error)
type GithubRefRequest ¶
type GithubRefResponse ¶
type GithubRefResponse struct {
Ref string `json:"ref"`
NodeId string `json:"node_id"`
Url string `json:"url"`
Object RefObject `json:"object"`
}
func CreateReference ¶
func CreateReference(request GithubRefRequest, branch string) (GithubRefResponse, error)
func GetReference ¶
func GetReference(branch string) (GithubRefResponse, error)
func UpdateReference ¶
func UpdateReference(request GithubRefRequest, branch string, createBranch bool) (GithubRefResponse, error)
type GithubTreeRequest ¶
type GithubTreeResponse ¶
type GithubTreeResponse struct {
Sha string `json:"sha"`
Url string `json:"url"`
Truncated bool `json:"truncated"`
Tree []TreeItem `json:"tree"`
}
func CreateTree ¶
func CreateTree(tree GithubTreeRequest) (GithubTreeResponse, error)
type Permissions ¶
type TokenInfo ¶
type TokenInfo struct {
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
Permissions Permissions `json:"permissions"`
RepositorySelection string `json:"repository_selection"`
}
type TreeItem ¶
type TreeItem struct {
Path string `json:"path"` // file referenced in the tree.
Mode string `json:"mode"` // Can be one of: 100644, 100755, 040000, 160000, 120000
Type string `json:"type"` // Can be one of: blob, tree, or commit.
Sha *string `json:"sha"`
Content string `json:"content,omitempty"`
Size int `json:"size,omitempty"`
Url string `json:"url,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.