Skip to content

Commit a20ae4e

Browse files
committed
cache(gha): don't require url attr if url_v2 is set
Signed-off-by: CrazyMax <[email protected]>
1 parent c45cd57 commit a20ae4e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cache/remotecache/gha/gha.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ func getConfig(attrs map[string]string) (*Config, error) {
6363
if !ok {
6464
scope = "buildkit"
6565
}
66-
url, ok := attrs[attrURL]
67-
if !ok {
68-
return nil, errors.Errorf("url not set for github actions cache")
69-
}
7066
token, ok := attrs[attrToken]
7167
if !ok {
7268
return nil, errors.Errorf("token not set for github actions cache")
@@ -80,12 +76,19 @@ func getConfig(attrs map[string]string) (*Config, error) {
8076
}
8177
apiVersionInt = int(i)
8278
}
79+
var url string
8380
if apiVersionInt != 1 {
8481
if v, ok := attrs[attrURLV2]; ok {
8582
url = v
8683
apiVersionInt = 2
8784
}
8885
}
86+
if v, ok := attrs[attrURL]; ok && url == "" {
87+
url = v
88+
}
89+
if url == "" {
90+
return nil, errors.Errorf("url not set for github actions cache")
91+
}
8992
// best effort on old clients
9093
if apiVersionInt == 0 {
9194
if strings.Contains(url, "results-receiver.actions.githubusercontent.com") {

0 commit comments

Comments
 (0)