MCPcopy Create free account
hub / github.com/github/gh-aw / updateSkillRefValue

Function updateSkillRefValue

pkg/cli/update_actions.go:758–791  ·  view source on GitHub ↗
(
	ctx context.Context,
	skillRef string,
	allowMajor, verbose bool,
	coolDown time.Duration,
	resolver skillRefUpdateResolver,
)

Source from the content-addressed store, hash-verified

756}
757
758func updateSkillRefValue(
759 ctx context.Context,
760 skillRef string,
761 allowMajor, verbose bool,
762 coolDown time.Duration,
763 resolver skillRefUpdateResolver,
764) (bool, string, error) {
765 trimmedSkillRef := strings.TrimSpace(skillRef)
766 if trimmedSkillRef == "" || strings.Contains(trimmedSkillRef, "${{") {
767 return false, skillRef, nil
768 }
769 spec, currentRef, ok := strings.Cut(trimmedSkillRef, "@")
770 spec = strings.TrimSpace(spec)
771 currentRef = strings.TrimSpace(currentRef)
772 if !ok || spec == "" || currentRef == "" {
773 return false, skillRef, nil
774 }
775
776 repo := gitutil.ExtractBaseRepo(spec)
777 if repo == "" {
778 return false, skillRef, nil
779 }
780 latestRef, err := resolver(ctx, repo, currentRef, allowMajor, verbose, coolDown)
781 if err != nil {
782 if verbose {
783 updateLog.Printf("Skipping skill update for %s@%s: %v", spec, currentRef, err)
784 }
785 return false, skillRef, nil
786 }
787 if latestRef == "" || latestRef == currentRef {
788 return false, skillRef, nil
789 }
790 return true, spec + "@" + latestRef, nil
791}
792
793func updateActionRefsInContentWithDeps(ctx context.Context, deps actionUpdateDeps, content string, cache map[string]latestReleaseResult, coolDownCache map[string]coolDownCheckResult, allowMajor, verbose bool, coolDown time.Duration) (bool, string, error) {
794 changed := false

Callers 1

Calls 2

ExtractBaseRepoFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected