Documentation
¶
Overview ¶
Package pin is a generated GoMock package.
Index ¶
- Variables
- type ActionDef
- type MockRepositoryService
- func (m *MockRepositoryService) EXPECT() *MockRepositoryServiceMockRecorder
- func (m *MockRepositoryService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *github.Response, error)
- func (m *MockRepositoryService) ListTags(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
- type MockRepositoryServiceMockRecorder
- type RepositoryService
- type ResolvedVersion
- type VersionResolver
Constants ¶
This section is empty.
Variables ¶
var AlreadyResolvedError = errors.New("already resolved")
var NoTagsFoundError = errors.New("repository has no tags")
var TagNotFoundError = errors.New("specified tag not found")
Functions ¶
This section is empty.
Types ¶
type ActionDef ¶
type ActionDef struct {
Owner string
Repo string
Path string // Subdirectory path after the repository name (e.g., "diff" in "oasdiff-action/diff")
RefOrSHA string
}
func (ActionDef) HasCommitSHA ¶
Check the ref is a commit SHA.
func (ActionDef) IsReusableWorkflow ¶ added in v0.3.0
IsReusableWorkflow determines if this action is a reusable workflow. Reusable workflows have file extensions in their path (e.g., .yml, .yaml). Composite actions do not have extensions in their path. This is for GitHub's SHA pinning enforcement policy (strict-pinning-202508).
func (ActionDef) VersionTag ¶
Extract version representation from ref. Version like string = 2.3.4, v2.3.4, v2.3.4-beta, v2.3.4+build, 2.3.4-beta, 2.3.4+build
If ref is not a version representation, returns nil.
type MockRepositoryService ¶
type MockRepositoryService struct {
// contains filtered or unexported fields
}
MockRepositoryService is a mock of RepositoryService interface.
func NewMockRepositoryService ¶
func NewMockRepositoryService(ctrl *gomock.Controller) *MockRepositoryService
NewMockRepositoryService creates a new mock instance.
func (*MockRepositoryService) EXPECT ¶
func (m *MockRepositoryService) EXPECT() *MockRepositoryServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepositoryService) GetCommitSHA1 ¶
func (m *MockRepositoryService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *github.Response, error)
GetCommitSHA1 mocks base method.
func (*MockRepositoryService) ListTags ¶
func (m *MockRepositoryService) ListTags(ctx context.Context, owner, repo string, opts *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error)
ListTags mocks base method.
type MockRepositoryServiceMockRecorder ¶
type MockRepositoryServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryServiceMockRecorder is the mock recorder for MockRepositoryService.
func (*MockRepositoryServiceMockRecorder) GetCommitSHA1 ¶
func (mr *MockRepositoryServiceMockRecorder) GetCommitSHA1(ctx, owner, repo, ref, lastSHA any) *gomock.Call
GetCommitSHA1 indicates an expected call of GetCommitSHA1.
type RepositoryService ¶
type RepositoryService interface {
ListTags(ctx context.Context, owner string, repo string, opts *gogithub.ListOptions) ([]*gogithub.RepositoryTag, *gogithub.Response, error)
// https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#get-a-reference
// > The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn't match an existing ref, a 404 is returned.
//
// Although the documentation states that the `:ref` must be prefixed with `tags/` or `heads/`,
// the GitHub API currently accepts unprefixed tags and branch names (e.g., /repos/OWNER/REPO/commits/main).
GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *gogithub.Response, error)
}
type ResolvedVersion ¶
type VersionResolver ¶
type VersionResolver struct {
// contains filtered or unexported fields
}
func NewVersionResolver ¶
func NewVersionResolver(repoService RepositoryService) VersionResolver
func (*VersionResolver) ResolveVersion ¶
func (r *VersionResolver) ResolveVersion(ctx context.Context, def ActionDef) (ResolvedVersion, error)