2024-08-31 03:09:31 +00:00
|
|
|
// Implementation for basic Action-related operations.
|
|
|
|
package actions
|
|
|
|
|
|
|
|
import (
|
2024-09-02 16:28:23 +00:00
|
|
|
"fmt"
|
2024-08-31 03:09:31 +00:00
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Returns a key that can be used as a directory / cache-key string
|
|
|
|
// based on the provided Action repository url.
|
|
|
|
func GetActionKey(url string) string {
|
|
|
|
url = strings.ToLower(url)
|
|
|
|
|
|
|
|
if strings.HasPrefix(url, "http://") {
|
|
|
|
url = strings.TrimPrefix(url, "http://")
|
|
|
|
} else if strings.HasPrefix(url, "https://") {
|
|
|
|
url = strings.TrimPrefix(url, "https://")
|
|
|
|
}
|
|
|
|
|
|
|
|
parts := strings.Split(url, "/")
|
|
|
|
|
|
|
|
return strings.Join(parts, "__")
|
|
|
|
}
|
2024-09-02 16:28:23 +00:00
|
|
|
|
|
|
|
func FormatInputEnvKey(inputKey string) string {
|
|
|
|
return fmt.Sprintf("INPUT_%s", strings.ReplaceAll(strings.ToUpper(inputKey), " ", "_"))
|
|
|
|
}
|