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

Function IsCommitSHA

pkg/cli/spec.go:507–518  ·  view source on GitHub ↗

IsCommitSHA checks if a version string looks like a commit SHA (40-character hex string)

(version string)

Source from the content-addressed store, hash-verified

505
506// IsCommitSHA checks if a version string looks like a commit SHA (40-character hex string)
507func IsCommitSHA(version string) bool {
508 if len(version) != 40 {
509 return false
510 }
511 // Check if all characters are hexadecimal
512 for _, char := range version {
513 if (char < '0' || char > '9') && (char < 'a' || char > 'f') && (char < 'A' || char > 'F') {
514 return false
515 }
516 }
517 return true
518}
519
520// genericURLWorkflowName derives a best-effort workflow name from a raw import URL.
521// It uses the last non-empty path segment, stripping any well-known file extensions.

Calls

no outgoing calls