@@ -5,26 +5,31 @@ import it.krzeminski.githubactionstyping.reporting.appendStatus
5
5
import it.krzeminski.githubactionstyping.validation.ItemValidationResult
6
6
import java.nio.file.Path
7
7
import kotlin.io.path.exists
8
+ import kotlin.io.path.invariantSeparatorsPathString
8
9
import kotlin.io.path.name
9
- import kotlin.io.path.nameWithoutExtension
10
- import kotlin.io.path.pathString
11
10
import kotlin.io.path.walk
12
11
13
12
/* *
14
13
* Runs validation for a given action, with its manifest files present in the current directory.
15
14
*
15
+ * @param ignoredActionFiles: Paths to 'action.y(a)ml' files that shouldn't be validated against their typings.
16
+ * The separator character is '/', regardless of the operating system.
16
17
* @param repoRoot: Allows customizing which path should be taken as repo root for action(-types).y(a)ml file discovery.
17
18
*
18
19
* @return a pair where:
19
20
* - the boolean means if the typings are valid
20
21
* - the string is a printable report, with details about all inputs and outputs
21
22
*/
22
- fun validateTypings (repoRoot : Path = Path .of(".")): Pair <Boolean , String > {
23
+ fun validateTypings (
24
+ ignoredActionFiles : List <String > = emptyList(),
25
+ repoRoot : Path = Path .of("."),
26
+ ): Pair <Boolean , String > {
23
27
require(repoRoot.exists()) { " The given repo root leads to non-existent dir: $repoRoot " }
24
28
25
29
val validationResultsForActions = repoRoot.walk()
26
30
.sorted()
27
31
.filter { it.name in setOf (" action.yml" , " action.yaml" ) }
32
+ .filter { repoRoot.relativize(it).invariantSeparatorsPathString !in ignoredActionFiles }
28
33
.map { manifestPath ->
29
34
val manifest = repoRoot.readYamlFile(manifestPath.parent.resolve(" action" ).toString())
30
35
val typesManifest = repoRoot.readYamlFile(manifestPath.parent.resolve(" action-types" ).toString())
0 commit comments