githubactions

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(ctx context.Context, opts ...Opt) *http.Client

NewHTTPClient creates an HTTP client configured with GitHub Actions OIDC authentication

func NewTokenSource

func NewTokenSource(opts ...Opt) oauth2.TokenSource

NewTokenSource creates a new token source for GitHub Actions OIDC It retrieves tokens from the GitHub Actions OIDC provider using environment variables See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect

Types

type Claims

type Claims struct {
	jwtvalidator.RegisteredClaims
	CustomClaims
}

func (*Claims) Validate

func (c *Claims) Validate(_ context.Context) error

Validate implements the CustomClaims interface

type CustomClaims

type CustomClaims struct {
	// GitHub actions specific
	Actor             string `json:"actor"`
	ActorID           string `json:"actor_id"`
	BaseRef           string `json:"base_ref"`
	Environment       string `json:"environment"`
	EventName         string `json:"event_name"`
	HeadRef           string `json:"head_ref"`
	JobWorkflowRef    string `json:"job_workflow_ref"`
	Ref               string `json:"ref"`
	RefType           string `json:"ref_type"`
	Repository        string `json:"repository"`
	RepositoryID      string `json:"repository_id"`
	RepositoryOwner   string `json:"repository_owner"`
	RepositoryOwnerID string `json:"repository_owner_id"`
	RunAttempt        string `json:"run_attempt"`
	RunID             string `json:"run_id"`
	RunNumber         string `json:"run_number"`
	RunnerEnvironment string `json:"runner_environment"`
	SHA               string `json:"sha"`
	Workflow          string `json:"workflow"`
	WorkflowRef       string `json:"workflow_ref"`
	WorkflowSHA       string `json:"workflow_sha"`
}

CustomClaims represents the custom claims in a GitHub Actions OIDC token

type Opt

type Opt func(*tokenSource)

Opt is a function option for configuring the token source

func WithAudience

func WithAudience(aud string) Opt

WithAudience sets the audience for the OIDC token

func WithHTTPClient

func WithHTTPClient(client *http.Client) Opt

WithHTTPClient sets a custom HTTP client for the token source

Jump to

Keyboard shortcuts

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