mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
cache: fix gha cache url handling
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
73f61aa338
commit
f7992033bf
@ -207,6 +207,7 @@ func addGithubToken(ci *controllerapi.CacheOptionsEntry) {
|
|||||||
}
|
}
|
||||||
version, ok := ci.Attrs["version"]
|
version, ok := ci.Attrs["version"]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
// https://github.com/actions/toolkit/blob/2b08dc18f261b9fdd978b70279b85cbef81af8bc/packages/cache/src/internal/config.ts#L19
|
||||||
if v, ok := os.LookupEnv("ACTIONS_CACHE_SERVICE_V2"); ok {
|
if v, ok := os.LookupEnv("ACTIONS_CACHE_SERVICE_V2"); ok {
|
||||||
if b, err := strconv.ParseBool(v); err == nil && b {
|
if b, err := strconv.ParseBool(v); err == nil && b {
|
||||||
version = "2"
|
version = "2"
|
||||||
@ -218,15 +219,18 @@ func addGithubToken(ci *controllerapi.CacheOptionsEntry) {
|
|||||||
ci.Attrs["token"] = v
|
ci.Attrs["token"] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if _, ok := ci.Attrs["url_v2"]; !ok && version == "2" {
|
||||||
|
// https://github.com/actions/toolkit/blob/2b08dc18f261b9fdd978b70279b85cbef81af8bc/packages/cache/src/internal/config.ts#L34-L35
|
||||||
|
if v, ok := os.LookupEnv("ACTIONS_RESULTS_URL"); ok {
|
||||||
|
ci.Attrs["url_v2"] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
if _, ok := ci.Attrs["url"]; !ok {
|
if _, ok := ci.Attrs["url"]; !ok {
|
||||||
if version == "2" {
|
// https://github.com/actions/toolkit/blob/2b08dc18f261b9fdd978b70279b85cbef81af8bc/packages/cache/src/internal/config.ts#L28-L33
|
||||||
if v, ok := os.LookupEnv("ACTIONS_RESULTS_URL"); ok {
|
if v, ok := os.LookupEnv("ACTIONS_CACHE_URL"); ok {
|
||||||
ci.Attrs["url_v2"] = v
|
ci.Attrs["url"] = v
|
||||||
}
|
} else if v, ok := os.LookupEnv("ACTIONS_RESULTS_URL"); ok {
|
||||||
} else {
|
ci.Attrs["url"] = v
|
||||||
if v, ok := os.LookupEnv("ACTIONS_CACHE_URL"); ok {
|
|
||||||
ci.Attrs["url"] = v
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user