Documentation
¶
Index ¶
- type ActionsIDToken
- type Client
- func (c *Client) CreateAppAccessToken(ctx context.Context, installationID uint64, ...) (*CreateAppAccessTokenResponse, error)
- func (c *Client) GetApp(ctx context.Context) (*GetAppResponse, error)
- func (c *Client) GetRepo(ctx context.Context, token, owner, repo string) (*GetRepoResponse, error)
- func (c *Client) GetReposContent(ctx context.Context, token, owner, repo, path string) (*GetReposContentResponse, error)
- func (c *Client) GetReposInfo(ctx context.Context, token, nodeID string) (*GetReposInfoResponse, error)
- func (c *Client) GetReposInstallation(ctx context.Context, owner, repo string) (*GetReposInstallationResponse, error)
- func (c *Client) ParseIDToken(ctx context.Context, idToken string) (*ActionsIDToken, error)
- func (c *Client) RevokeAppAccessToken(ctx context.Context, token string) error
- func (c *Client) ValidateAPIURL(url string) error
- type CreateAppAccessTokenRequest
- type CreateAppAccessTokenRequestPermissions
- type CreateAppAccessTokenResponse
- type Doer
- type GetAppResponse
- type GetRepoResponse
- type GetReposContentResponse
- type GetReposInfoResponse
- type GetReposInstallationResponse
- type KMSService
- type UnexpectedStatusCodeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionsIDToken ¶
type ActionsIDToken struct {
*jwt.Claims
Environment string `jwt:"environment"`
Ref string `jwt:"ref"`
SHA string `jwt:"sha"`
Repository string `jwt:"repository"`
RepositoryOwner string `jwt:"repository_owner"`
ActorID string `jwt:"actor_id"`
RepositoryVisibility string `jwt:"repository_visibility"`
RepositoryID string `jwt:"repository_id"`
RepositoryOwnerID string `jwt:"repository_owner_id"`
RunID string `jwt:"run_id"`
RunNumber string `jwt:"run_number"`
RunAttempt string `jwt:"run_attempt"`
Actor string `jwt:"actor"`
Workflow string `jwt:"workflow"`
HeadRef string `jwt:"head_ref"`
BaseRef string `jwt:"base_ref"`
EventName string `jwt:"event_name"`
EventType string `jwt:"branch"`
RefType string `jwt:"ref_type"`
JobWorkflowRef string `jwt:"job_workflow_ref"`
}
GitHub's custom claims https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a very light weight GitHub API Client.
func (*Client) CreateAppAccessToken ¶
func (c *Client) CreateAppAccessToken(ctx context.Context, installationID uint64, permissions *CreateAppAccessTokenRequest) (*CreateAppAccessTokenResponse, error)
CreateAppAccessToken creates an installation access token for the app https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app
func (*Client) GetApp ¶
func (c *Client) GetApp(ctx context.Context) (*GetAppResponse, error)
GetApp returns the GitHub App associated with the authentication credentials used. https://docs.github.com/en/rest/reference/apps#get-the-authenticated-app
func (*Client) GetRepo ¶
GetRepo gets a repository. https://docs.github.com/en/rest/repos/repos#get-a-repository
func (*Client) GetReposContent ¶
func (c *Client) GetReposContent(ctx context.Context, token, owner, repo, path string) (*GetReposContentResponse, error)
GetReposContent gets a repository content. https://docs.github.com/en/rest/repos/contents#get-repository-content
func (*Client) GetReposInfo ¶
func (c *Client) GetReposInfo(ctx context.Context, token, nodeID string) (*GetReposInfoResponse, error)
GetReposContent gets a repository content. https://docs.github.com/en/rest/repos/contents#get-repository-content
func (*Client) GetReposInstallation ¶
func (c *Client) GetReposInstallation(ctx context.Context, owner, repo string) (*GetReposInstallationResponse, error)
GetReposInstallation gets a repository installation for the authenticated app https://docs.github.com/en/rest/reference/apps#get-a-repository-installation-for-the-authenticated-app
func (*Client) ParseIDToken ¶
func (*Client) RevokeAppAccessToken ¶
RevokeAppAccessToken revokes the token. https://docs.github.com/en/rest/apps/installations#revoke-an-installation-access-token
func (*Client) ValidateAPIURL ¶
ValidateAPIURL validates the API URL of the client. It returns an error if the URL is not valid.
type CreateAppAccessTokenRequest ¶
type CreateAppAccessTokenRequest struct {
Repositories []string `json:"repositories,omitempty"`
RepositoryIDs []uint64 `json:"repository_ids,omitempty"`
Permissions *CreateAppAccessTokenRequestPermissions `json:"permissions,omitempty"`
}
type CreateAppAccessTokenRequestPermissions ¶
type CreateAppAccessTokenRequestPermissions struct {
Actions string `json:"actions,omitempty"`
Administration string `json:"administration,omitempty"`
ArtifactMetadata string `json:"artifact_metadata,omitempty"`
Attestations string `json:"attestations,omitempty"`
Checks string `json:"checks,omitempty"`
Codespaces string `json:"codespaces,omitempty"`
Contents string `json:"contents,omitempty"`
CustomPropertiesForOrganizations string `json:"custom_properties_for_organizations,omitempty"`
DependabotSecrets string `json:"dependabot_secrets,omitempty"`
Deployments string `json:"deployments,omitempty"`
Discussions string `json:"discussions,omitempty"`
EmailAddresses string `json:"email_addresses,omitempty"`
EnterpriseCustomPropertiesForOrganizations string `json:"enterprise_custom_properties_for_organizations,omitempty"`
Environments string `json:"environments,omitempty"`
Followers string `json:"followers,omitempty"`
GitSSHKeys string `json:"git_ssh_keys,omitempty"`
GPGKeys string `json:"gpg_keys,omitempty"`
InteractionLimits string `json:"interaction_limits,omitempty"`
Issues string `json:"issues,omitempty"`
Members string `json:"members,omitempty"`
MergeQueues string `json:"merge_queues,omitempty"`
Metadata string `json:"metadata,omitempty"`
OrganizationAdministration string `json:"organization_administration,omitempty"`
OrganizationAnnouncementBanners string `json:"organization_announcement_banners,omitempty"`
OrganizationCopilotSeatManagement string `json:"organization_copilot_seat_management,omitempty"`
OrganizationCustomOrgRoles string `json:"organization_custom_org_roles,omitempty"`
OrganizationCustomProperties string `json:"organization_custom_properties,omitempty"`
OrganizationCustomRoles string `json:"organization_custom_roles,omitempty"`
OrganizationEvents string `json:"organization_events,omitempty"`
OrganizationHooks string `json:"organization_hooks,omitempty"`
OrganizationPackages string `json:"organization_packages,omitempty"`
OrganizationPersonalAccessTokenRequests string `json:"organization_personal_access_token_requests,omitempty"`
OrganizationPersonalAccessTokens string `json:"organization_personal_access_tokens,omitempty"`
OrganizationPlan string `json:"organization_plan,omitempty"`
OrganizationProjects string `json:"organization_projects,omitempty"`
OrganizationSecrets string `json:"organization_secrets,omitempty"`
OrganizationSelfHostedRunners string `json:"organization_self_hosted_runners,omitempty"`
OrganizationUserBlocking string `json:"organization_user_blocking,omitempty"`
Packages string `json:"packages,omitempty"`
Pages string `json:"pages,omitempty"`
Profile string `json:"profile,omitempty"`
PullRequests string `json:"pull_requests,omitempty"`
RepositoryCustomProperties string `json:"repository_custom_properties,omitempty"`
RepositoryHooks string `json:"repository_hooks,omitempty"`
RepositoryProjects string `json:"repository_projects,omitempty"`
SecretScanningAlerts string `json:"secret_scanning_alerts,omitempty"`
Secrets string `json:"secrets,omitempty"`
SecurityEvents string `json:"security_events,omitempty"`
SingleFile string `json:"single_file,omitempty"`
Starring string `json:"starring,omitempty"`
Statuses string `json:"statuses,omitempty"`
TeamDiscussions string `json:"team_discussions,omitempty"`
VulnerabilityAlerts string `json:"vulnerability_alerts,omitempty"`
Workflows string `json:"workflows,omitempty"`
}
type CreateAppAccessTokenResponse ¶
type CreateAppAccessTokenResponse struct {
Token string `json:"token"`
}
type GetAppResponse ¶
type GetAppResponse struct {
HTMLURL string `json:"html_url"`
}
type GetRepoResponse ¶
type GetReposContentResponse ¶
type GetReposContentResponse struct {
Type string `json:"type"`
Encoding string `json:"encoding"`
Content string `json:"content"`
}
func (*GetReposContentResponse) ParseFile ¶
func (resp *GetReposContentResponse) ParseFile() ([]byte, error)
type GetReposInfoResponse ¶
type GetReposInstallationResponse ¶
type GetReposInstallationResponse struct {
ID uint64 `json:"id"`
}
type KMSService ¶
type KMSService interface {
Sign(ctx context.Context, params *kms.SignInput, optFns ...func(*kms.Options)) (*kms.SignOutput, error)
}
KMSService is a subset of AWS KMS client interface used for signing JWTs.
type UnexpectedStatusCodeError ¶
func (*UnexpectedStatusCodeError) Error ¶
func (err *UnexpectedStatusCodeError) Error() string