-
Notifications
You must be signed in to change notification settings - Fork 10
/
inconsistentVersionsInGitHubCI.fsx
executable file
·39 lines (29 loc) · 1.31 KB
/
inconsistentVersionsInGitHubCI.fsx
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
#!/usr/bin/env -S dotnet fsi
open System.IO
#r "nuget: Mono.Unix, Version=7.1.0-final.1.21458.1"
#r "nuget: YamlDotNet, Version=16.1.3"
#load "../src/FileConventions/Library.fs"
#load "../src/FileConventions/Helpers.fs"
let rootDir = Path.Combine(__SOURCE_DIRECTORY__, "..") |> DirectoryInfo
let githubWorkflowsDirFromRootDir =
Path.Combine(rootDir.FullName, ".github", "workflows") |> DirectoryInfo
let currentDir = Directory.GetCurrentDirectory() |> DirectoryInfo
let githubWorkflowsDirFromCurrentDir =
Path.Combine(currentDir.FullName, ".github", "workflows") |> DirectoryInfo
let targetDir =
match
githubWorkflowsDirFromRootDir.Exists,
githubWorkflowsDirFromCurrentDir.Exists
with
| true, false -> githubWorkflowsDirFromRootDir
| false, true -> githubWorkflowsDirFromCurrentDir
| false, false -> failwith "No .github/workflows/ subfolder found"
| true, true ->
Helpers.PreferLessDeeplyNestedDir
githubWorkflowsDirFromCurrentDir
githubWorkflowsDirFromRootDir
let inconsistentVersionsInGitHubCI =
FileConventions.DetectInconsistentVersionsInGitHubCI targetDir
if inconsistentVersionsInGitHubCI then
failwith
"You shouldn't use inconsistent versions in `uses: foo@bar` or `with: foo-version: bar` statements in GitHubCI files."