Skip to content

Commit 4d93677

Browse files
committed
Collect typing differences into list
The goal is to facilitate creation of PRs after all actions are analyzed.
1 parent e3aad7c commit 4d93677

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/test.main.kts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ private data class ActionCoords(
124124
val pathToTypings: String,
125125
)
126126

127+
private data class TypingDifference(
128+
val action: ActionCoords,
129+
val extraInputsInManifest: Set<String>,
130+
val extraInputsInTypings: Set<String>,
131+
val extraOutputsInManifest: Set<String>,
132+
val extraOutputsInTypings: Set<String>,
133+
)
134+
127135
private fun validateTypings(sha: String, baseRef: String?) {
128136
val typingsSchema = JsonSchema.fromDefinition(
129137
URI.create("https://raw.githubusercontent.com/typesafegithub/github-actions-typing/" +
@@ -140,6 +148,8 @@ private fun validateTypings(sha: String, baseRef: String?) {
140148

141149
var shouldFail = false
142150

151+
val typingDifferences = mutableListOf<TypingDifference>()
152+
143153
for (action in actions) {
144154
println()
145155
println("\uFE0F For https://github.com/${action.owner}/${action.name}/tree/${action.version}/${action.path ?: ""}")
@@ -181,18 +191,17 @@ private fun validateTypings(sha: String, baseRef: String?) {
181191

182192
if (typingsInputs != manifestInputs || typingsOutputs != manifestOutputs) {
183193
println("\uD83D\uDD34 Something is wrong with the typings!")
184-
(typingsInputs - manifestInputs).let {
185-
if (it.isNotEmpty()) { println("Extra inputs in typings: $it") }
186-
}
187-
(manifestInputs - typingsInputs).let {
188-
if (it.isNotEmpty()) { println("Extra inputs in manifest: $it") }
189-
}
190-
(typingsOutputs - manifestOutputs).let {
191-
if (it.isNotEmpty()) { println("Extra outputs in typings: $it") }
192-
}
193-
(manifestOutputs - typingsOutputs).let {
194-
if (it.isNotEmpty()) { println("Extra outputs in manifest: $it") }
195-
}
194+
195+
val difference = TypingDifference(
196+
action = action,
197+
extraInputsInManifest = manifestInputs - typingsInputs,
198+
extraInputsInTypings = typingsInputs - manifestInputs,
199+
extraOutputsInManifest = manifestOutputs - typingsOutputs,
200+
extraOutputsInTypings = typingsOutputs - manifestOutputs
201+
)
202+
println(typingDifferences)
203+
204+
typingDifferences += difference
196205
shouldFail = true
197206
continue
198207
}

0 commit comments

Comments
 (0)