-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
SvgoActionV4.kt
123 lines (115 loc) · 4.52 KB
/
SvgoActionV4.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
// 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.ericcornelissen
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: SVGO action
*
* Automatically run SVGO with GitHub Actions
*
* [Action on GitHub](https://github.com/ericcornelissen/svgo-action)
*
* @param repoToken The GITHUB_TOKEN secret
* @param dryRun Run the action in dry mode (i.e. do not write optimized SVGs)
* @param ignore A glob of SVGs that should not be optimized
* @param strict Fail the Action run even in the event of a recoverable error
* @param svgoConfig The path of the configuration file for SVGO
* @param svgoVersion The SVGO version to be used (`2`, `3`, or from `project`)
* @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 SvgoActionV4 private constructor(
/**
* The GITHUB_TOKEN secret
*/
public val repoToken: String? = null,
/**
* Run the action in dry mode (i.e. do not write optimized SVGs)
*/
public val dryRun: Boolean? = null,
/**
* A glob of SVGs that should not be optimized
*/
public val ignore: List<String>? = null,
/**
* Fail the Action run even in the event of a recoverable error
*/
public val strict: Boolean? = null,
/**
* The path of the configuration file for SVGO
*/
public val svgoConfig: String? = null,
/**
* The SVGO version to be used (`2`, `3`, or from `project`)
*/
public val svgoVersion: String? = 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<SvgoActionV4.Outputs>("ericcornelissen", "svgo-action", _customVersion ?: "v4") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
repoToken: String? = null,
dryRun: Boolean? = null,
ignore: List<String>? = null,
strict: Boolean? = null,
svgoConfig: String? = null,
svgoVersion: String? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(repoToken=repoToken, dryRun=dryRun, ignore=ignore, strict=strict,
svgoConfig=svgoConfig, svgoVersion=svgoVersion, _customInputs=_customInputs,
_customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
repoToken?.let { "repo-token" to it },
dryRun?.let { "dry-run" to it.toString() },
ignore?.let { "ignore" to it.joinToString("\n") },
strict?.let { "strict" to it.toString() },
svgoConfig?.let { "svgo-config" to it },
svgoVersion?.let { "svgo-version" to it },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* Boolean indicating if any SVGs were optimized
*/
public val didOptimize: String = "steps.$stepId.outputs.DID_OPTIMIZE"
/**
* The number of SVGs that were optimized
*/
public val optimizedCount: String = "steps.$stepId.outputs.OPTIMIZED_COUNT"
/**
* The number of SVGs that were detected
*/
public val svgCount: String = "steps.$stepId.outputs.SVG_COUNT"
}
}