Skip to content

Commit

Permalink
feat(actions): add actions/cache@v4
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 committed Jan 20, 2024
1 parent 5a8f92f commit cf6ec78
Show file tree
Hide file tree
Showing 12 changed files with 383 additions and 6 deletions.
Empty file added actions/actions/cache/v4/action
Empty file.
1 change: 1 addition & 0 deletions actions/actions/cache/v4/commit-hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13aacd865c20de90d75de3b17ebe84f7a17d57d2
Empty file.
Empty file.
8 changes: 4 additions & 4 deletions docs/supported-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Click on a version to see the binding's code.
* [clippy-check](https://github.com/actions-rs/clippy-check) - v1: [`ClippyCheckV1`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actionsrs/ClippyCheckV1.kt)
* [toolchain](https://github.com/actions-rs/toolchain) - v1: [`ToolchainV1`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actionsrs/ToolchainV1.kt)
* actions
* [cache/restore](https://github.com/actions/cache/tree/v3/restore) - v3: [`CacheRestoreV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheRestoreV3.kt)
* [cache/save](https://github.com/actions/cache/tree/v3/save) - v3: [`CacheSaveV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheSaveV3.kt)
* [cache](https://github.com/actions/cache) - v2: [`CacheV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheV2.kt), v3: [`CacheV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheV3.kt)
* [cache/restore](https://github.com/actions/cache/tree/v3/restore) - v3: [`CacheRestoreV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheRestoreV3.kt), v4: [`CacheRestoreV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheRestoreV4.kt)
* [cache/save](https://github.com/actions/cache/tree/v3/save) - v3: [`CacheSaveV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheSaveV3.kt), v4: [`CacheSaveV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheSaveV4.kt)
* [cache](https://github.com/actions/cache) - v2: [`CacheV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheV2.kt), v3: [`CacheV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheV3.kt), v4: [`CacheV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CacheV4.kt)
* [checkout](https://github.com/actions/checkout) - v2: [`CheckoutV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CheckoutV2.kt), v3: [`CheckoutV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CheckoutV3.kt), v4: [`CheckoutV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CheckoutV4.kt)
* [create-release](https://github.com/actions/create-release) - v1: [`CreateReleaseV1`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/CreateReleaseV1.kt)
* [download-artifact](https://github.com/actions/download-artifact) - v2: [`DownloadArtifactV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/DownloadArtifactV2.kt), v3: [`DownloadArtifactV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/DownloadArtifactV3.kt), v4: [`DownloadArtifactV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/DownloadArtifactV4.kt)
Expand Down Expand Up @@ -140,6 +140,6 @@ Click on a version to see the binding's code.
Number of bindings available:

* counting by actions: 84
* counting each version separately: 144
* counting each version separately: 147

Actions [providing typings](https://github.com/typesafegithub/github-actions-typing/) (marked with ✅ on the above list): 18
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)

package io.github.typesafegithub.workflows.actions.actions
Expand All @@ -12,6 +13,7 @@ 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.String
import kotlin.Suppress
import kotlin.Unit
Expand Down Expand Up @@ -41,6 +43,10 @@ import kotlin.collections.toTypedArray
* @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: CacheRestoreV4",
replaceWith = ReplaceWith("CacheRestoreV4"),
)
public data class CacheRestoreV3 private constructor(
/**
* A list of files, directories, and wildcard patterns to restore
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// 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",
)

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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.toList
import kotlin.collections.toTypedArray

/**
* Action: Restore Cache
*
* Restore Cache artifacts like dependencies and build outputs to improve workflow execution time
*
* [Action on GitHub](https://github.com/actions/cache/tree/v4/restore)
*
* @param path A list of files, directories, and wildcard patterns to restore
* @param key An explicit key for restoring 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 enableCrossOsArchive An optional boolean when enabled, allows windows runners to restore
* caches that were saved 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
*/
public data class CacheRestoreV4 private constructor(
/**
* A list of files, directories, and wildcard patterns to restore
*/
public val path: List<String>,
/**
* An explicit key for restoring 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,
/**
* An optional boolean when enabled, allows windows runners to restore caches that were saved 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<CacheRestoreV4.Outputs>("actions", "cache/restore", _customVersion ?: "v4") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
path: List<String>,
key: String,
restoreKeys: List<String>? = 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, 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") },
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"

/**
* A resolved cache key for which cache match was attempted
*/
public val cachePrimaryKey: String = "steps.$stepId.outputs.cache-primary-key"

/**
* Key of the cache that was restored, it could either be the primary key on cache-hit or a
* partial/complete match of one of the restore keys
*/
public val cacheMatchedKey: String = "steps.$stepId.outputs.cache-matched-key"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)

package io.github.typesafegithub.workflows.actions.actions
Expand All @@ -12,6 +13,7 @@ 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
Expand All @@ -38,6 +40,10 @@ import kotlin.collections.toTypedArray
* @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: CacheSaveV4",
replaceWith = ReplaceWith("CacheSaveV4"),
)
public data class CacheSaveV3 private constructor(
/**
* A list of files, directories, and wildcard patterns to cache
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// 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",
)

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.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: Save a cache
*
* Save Cache artifacts like dependencies and build outputs to improve workflow execution time
*
* [Action on GitHub](https://github.com/actions/cache/tree/v4/save)
*
* @param path A list of files, directories, and wildcard patterns to cache
* @param key An explicit key for saving the cache
* @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
* caches that can be restored on other platforms
* @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
*/
public data class CacheSaveV4 private constructor(
/**
* A list of files, directories, and wildcard patterns to cache
*/
public val path: List<String>,
/**
* An explicit key for saving the cache
*/
public val key: String,
/**
* 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 caches that can be restored
* on other platforms
*/
public val enableCrossOsArchive: 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<Action.Outputs>("actions", "cache/save", _customVersion ?: "v4") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
path: List<String>,
key: String,
uploadChunkSize: Int? = null,
enableCrossOsArchive: Boolean? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(path=path, key=key, uploadChunkSize=uploadChunkSize,
enableCrossOsArchive=enableCrossOsArchive, _customInputs=_customInputs,
_customVersion=_customVersion)

@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
"path" to path.joinToString("\n"),
"key" to key,
uploadChunkSize?.let { "upload-chunk-size" to it.toString() },
enableCrossOsArchive?.let { "enableCrossOsArchive" to it.toString() },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)

override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlin.collections.toTypedArray
* version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
message = "This action has a newer major version: CacheV3",
replaceWith = ReplaceWith("CacheV3"),
message = "This action has a newer major version: CacheV4",
replaceWith = ReplaceWith("CacheV4"),
)
public data class CacheV2 private constructor(
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)

package io.github.typesafegithub.workflows.actions.actions
Expand All @@ -12,6 +13,7 @@ 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
Expand Down Expand Up @@ -43,6 +45,10 @@ import kotlin.collections.toTypedArray
* @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
Expand Down

0 comments on commit cf6ec78

Please sign in to comment.