-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
CacheV3.kt
133 lines (127 loc) · 5.41 KB
/
CacheV3.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
// changes will be overwritten with the next binding code regeneration.
// See https://github.com/typesafegithub/github-workflows-kt for more info.
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)
package io.github.typesafegithub.workflows.actions.actions
import io.github.typesafegithub.workflows.domain.actions.Action
import io.github.typesafegithub.workflows.domain.actions.RegularAction
import java.util.LinkedHashMap
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.toList
import kotlin.collections.toTypedArray
/**
* Action: Cache
*
* Cache artifacts like dependencies and build outputs to improve workflow execution time
*
* [Action on GitHub](https://github.com/actions/cache)
*
* @param path A list of files, directories, and wildcard patterns to cache and restore
* @param key An explicit key for restoring and saving the cache
* @param restoreKeys An ordered list of keys to use for restoring stale cache if no cache hit
* occurred for key. Note `cache-hit` returns false in this case.
* @param uploadChunkSize The chunk size used to split up large files during upload, in bytes
* @param enableCrossOsArchive An optional boolean when enabled, allows windows runners to save or
* restore caches that can be restored or saved respectively on other platforms
* @param failOnCacheMiss Fail the workflow if cache entry is not found
* @param lookupOnly Check if a cache entry exists for the given input(s) (key, restore-keys)
* without downloading the cache
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by
* the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor
* version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
message = "This action has a newer major version: CacheV4",
replaceWith = ReplaceWith("CacheV4"),
)
public data class CacheV3 private constructor(
/**
* A list of files, directories, and wildcard patterns to cache and restore
*/
public val path: List<String>,
/**
* An explicit key for restoring and saving the cache
*/
public val key: String,
/**
* An ordered list of keys to use for restoring stale cache if no cache hit occurred for key.
* Note `cache-hit` returns false in this case.
*/
public val restoreKeys: List<String>? = null,
/**
* The chunk size used to split up large files during upload, in bytes
*/
public val uploadChunkSize: Int? = null,
/**
* An optional boolean when enabled, allows windows runners to save or restore caches that can
* be restored or saved respectively on other platforms
*/
public val enableCrossOsArchive: Boolean? = null,
/**
* Fail the workflow if cache entry is not found
*/
public val failOnCacheMiss: Boolean? = null,
/**
* Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading
* the cache
*/
public val lookupOnly: Boolean? = null,
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
public val _customInputs: Map<String, String> = mapOf(),
/**
* Allows overriding action's version, for example to use a specific minor version, or a newer
* version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
) : RegularAction<CacheV3.Outputs>("actions", "cache", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
path: List<String>,
key: String,
restoreKeys: List<String>? = null,
uploadChunkSize: Int? = null,
enableCrossOsArchive: Boolean? = null,
failOnCacheMiss: Boolean? = null,
lookupOnly: Boolean? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(path=path, key=key, restoreKeys=restoreKeys, uploadChunkSize=uploadChunkSize,
enableCrossOsArchive=enableCrossOsArchive, failOnCacheMiss=failOnCacheMiss,
lookupOnly=lookupOnly, _customInputs=_customInputs, _customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"path" to path.joinToString("\n"),
"key" to key,
restoreKeys?.let { "restore-keys" to it.joinToString("\n") },
uploadChunkSize?.let { "upload-chunk-size" to it.toString() },
enableCrossOsArchive?.let { "enableCrossOsArchive" to it.toString() },
failOnCacheMiss?.let { "fail-on-cache-miss" to it.toString() },
lookupOnly?.let { "lookup-only" to it.toString() },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* A boolean value to indicate an exact match was found for the primary key
*/
public val cacheHit: String = "steps.$stepId.outputs.cache-hit"
}
}