Documentation
¶
Index ¶
- Variables
- func DescribeHead(ctx context.Context, repoPath string) (string, error)
- func Fetch(ctx context.Context, input FetchInput) error
- func GetRepositoryName(ctx context.Context, repoPath, githubInstance, remoteName string) (string, error)
- func ResolveHead(ctx context.Context, repoPath string) (shortSha, sha string, err error)
- func ResolveRevision(ctx context.Context, repoPath, rev string) (string, error)
- func RunWithOutput(cmd *exec.Cmd) ([]byte, error)
- type CloneInput
- type Error
- type FetchInput
- type ObjectFormat
- type Worktree
Constants ¶
This section is empty.
Variables ¶
var (
ErrShortRef = errors.New("short SHA references are not supported")
)
Functions ¶
func DescribeHead ¶
DescribeHead resolves the symbolic name (tag or branch) of HEAD.
func GetRepositoryName ¶
func GetRepositoryName(ctx context.Context, repoPath, githubInstance, remoteName string) (string, error)
GetRepositoryName determines the name of a repository (for example, `actions/checkout`) by extracting it from the URL of the remote with the given remoteName.
func ResolveHead ¶
ResolveHead determines the commit ID of the current HEAD.
func ResolveRevision ¶
ResolveRevision determines the commit ID of the given revision (commit ID, tag, branch, HEAD, ...).
*Warning*: ResolveRevision is not suitable to test whether a commit is actually present.
Types ¶
type CloneInput ¶
type CloneInput struct {
CacheDir string // parent-location for all git caches that the runner maintains
URL string // url of the remote to clone
Ref string // reference from the remote; eg. tag, branch, or sha
Token string // authentication token
OfflineMode bool // when true, no remote operations will occur
InsecureSkipTLS bool // when true, TLS verification will be skipped on remote operations
}
CloneInput is a parameter struct for the method `Clone` to simplify the multiple parameters required.
type FetchInput ¶
type FetchInput struct {
// contains filtered or unexported fields
}
type ObjectFormat ¶ added in v13.2.0
type ObjectFormat string
const ( ObjectFormatSHA1 ObjectFormat = "sha1" ObjectFormatSHA256 ObjectFormat = "sha256" )
func ProbeObjectFormat ¶ added in v13.2.0
func ProbeObjectFormat(ctx context.Context, options gitOptions) (ObjectFormat, error)
Discover remote repo object format via commit hash size.
type Worktree ¶
type Worktree interface {
Close(ctx context.Context) error
WorktreeDir() string // fully qualified path to the work tree for this repo
}
func Clone ¶
func Clone(ctx context.Context, input CloneInput) (Worktree, error)
Perform a shallow clone-like operation, ensuring that the latest code at the `input.Ref` revision are fetched from the remote. Fetched repo contents are stored opaquely in the provided `CacheDir`, and may be reused by future shallow-clone operations. The returned value contains a path to the working tree that can be used to interact with the requested ref; it must be closed to indicate operations against it are complete.