Skip to content
Snippets Groups Projects
Commit c4032f4a authored by Kevin Schneider's avatar Kevin Schneider
Browse files

lol

parent fd8ae811
No related branches found
No related tags found
No related merge requests found
test.fsx 0 → 100644
open System
open System.IO
open System.Text.Json
type ProcessResult = {
ExitCode : int;
StdOut : string;
StdErr : string
}
let executeProcess (processName: string) (processArgs: string) =
let psi = new Diagnostics.ProcessStartInfo(processName, processArgs)
psi.UseShellExecute <- false
psi.RedirectStandardOutput <- true
psi.RedirectStandardError <- true
psi.CreateNoWindow <- true
let proc = Diagnostics.Process.Start(psi)
let output = new Text.StringBuilder()
let error = new Text.StringBuilder()
proc.OutputDataReceived.Add(fun args -> output.Append(args.Data) |> ignore)
proc.ErrorDataReceived.Add(fun args -> error.Append(args.Data) |> ignore)
proc.BeginErrorReadLine()
proc.BeginOutputReadLine()
proc.WaitForExit()
{ ExitCode = proc.ExitCode; StdOut = output.ToString(); StdErr = error.ToString() }
let changed_files = File.ReadAllLines("file_changes.txt") |> set
type ValidationPackageIndex =
{
Name: string
LastUpdated: System.DateTime
}
Directory.GetFiles("validation_packages", "*.fsx")
|> Array.map (fun package ->
if changed_files.Contains(package) then
{ Name = package; LastUpdated = System.DateTime.Now}
else
printfn $"{package} was changed in this commit."
let history = executeProcess "git" $"log -1 --pretty=format:%%ci {package}"
{ Name = package; LastUpdated = System.DateTime.ParseExact(history.StdOut.Split(" ").[0], "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)}
)
|> fun packages -> JsonSerializer.Serialize(packages)
|> fun json -> File.WriteAllText("validation_packages.json", json)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment