pin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pin is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var AlreadyResolvedError = errors.New("already resolved")
View Source
var NoTagsFoundError = errors.New("repository has no tags")
View Source
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

func (a ActionDef) HasCommitSHA() bool

Check the ref is a commit SHA.

func (ActionDef) IsReusableWorkflow added in v0.3.0

func (a ActionDef) IsReusableWorkflow() bool

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

func (a ActionDef) VersionTag() *semver.Version

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

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.

func (*MockRepositoryServiceMockRecorder) ListTags

func (mr *MockRepositoryServiceMockRecorder) ListTags(ctx, owner, repo, opts any) *gomock.Call

ListTags indicates an expected call of ListTags.

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 ResolvedVersion struct {
	CommitSHA  string
	RefComment string
}

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)

Jump to

Keyboard shortcuts

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