CheckIfRemoteTag check if repoRef is a tag.
(target, repoUrl, repoRef string)
| 28 | |
| 29 | // CheckIfRemoteTag check if repoRef is a tag. |
| 30 | func CheckIfRemoteTag(target, repoUrl, repoRef string) (bool, error) { |
| 31 | title := fmt.Sprintf("[query remote tag: %s]", target) |
| 32 | output, err := cmd.NewExecutor(title, "git", "ls-remote", "--tags", repoUrl, repoRef). |
| 33 | WithRetry(retryMaxAttempts).ExecuteOutput() |
| 34 | if err != nil { |
| 35 | return false, fmt.Errorf("failed to query remote tag %s of %s -> %w", repoRef, repoUrl, err) |
| 36 | } |
| 37 | return strings.TrimSpace(output) != "", nil |
| 38 | } |
| 39 | |
| 40 | // GetRemoteHeadCommit resolves the HEAD commit of a remote repository. |
| 41 | func GetRemoteHeadCommit(target, repoUrl string) (string, error) { |
no test coverage detected