Skip to content

Commit 6b4fa38

Browse files
committed
[#13] feat!: use GitHub's way to print debug info
The only action's input - `verbose` - is now not needed.
1 parent 66f7a98 commit 6b4fa38

File tree

4 files changed

+16
-33
lines changed

4 files changed

+16
-33
lines changed

action-types.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
inputs:
2-
verbose:
3-
type: boolean

action.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
name: GitHub Actions Typing
22
description: Bring type-safety to your GitHub actions' API!
33
author: Piotr Krzemiński
4-
inputs:
5-
verbose:
6-
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
7-
required: false
8-
default: 'false'
94
runs:
105
using: 'docker'
116
image: 'Dockerfile'

src/main/kotlin/it/krzeminski/githubactionstyping/ManifestsToReport.kt

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package it.krzeminski.githubactionstyping
22

3-
import it.krzeminski.githubactionstyping.github.getBooleanInput
43
import it.krzeminski.githubactionstyping.parsing.TypesManifest
54
import it.krzeminski.githubactionstyping.parsing.parseManifest
65
import it.krzeminski.githubactionstyping.parsing.parseTypesManifest
@@ -30,27 +29,30 @@ fun manifestsToReport(manifest: String, typesManifest: String): Pair<Boolean, St
3029
throw IllegalStateException("The same set of outputs should exist in action manifest and types manifest!")
3130
}
3231

33-
if (getBooleanInput("verbose")) {
34-
println("Action's manifest:")
35-
println(manifest)
32+
printlnDebug("Action's manifest:")
33+
printlnDebug(manifest)
3634

37-
println("Parsed manifest:")
38-
println(parsedManifest)
35+
printlnDebug("Parsed manifest:")
36+
printlnDebug(parsedManifest)
3937

40-
println("Action's types manifest:")
41-
println(typesManifest)
38+
printlnDebug("Action's types manifest:")
39+
printlnDebug(typesManifest)
4240

43-
println("Parsed types manifest:")
44-
println(parsedTypesManifest)
41+
printlnDebug("Parsed types manifest:")
42+
printlnDebug(parsedTypesManifest)
4543

46-
println()
47-
println("==============================================")
48-
println()
49-
}
44+
printlnDebug()
45+
printlnDebug("==============================================")
46+
printlnDebug()
5047

5148
val validationResult = parsedTypesManifest.validate()
5249
val isValid = validationResult.overallResult is ItemValidationResult.Valid
5350
val report = validationResult.toPlaintextReport()
5451

5552
return Pair(isValid, report)
5653
}
54+
55+
private fun printlnDebug(string: Any? = null) =
56+
(string ?: "").toString().lines()
57+
.map { "::debug::$it" }
58+
.forEach { println(it) }

src/main/kotlin/it/krzeminski/githubactionstyping/github/ActionInputsReading.kt

-11
This file was deleted.

0 commit comments

Comments
 (0)