@@ -72,6 +72,7 @@ type GitNetRuntime(config: GitNetConfig) =
7272 let index = this.repo |> Repository.index
7373 try
7474 for file in files do index |> Index.addFile file
75+ index |> Index.write
7576 with e -> printfn $" Failed to stage files:\n %A {e}"
7677 /// <summary >
7778 /// Commits staged files.
@@ -81,14 +82,17 @@ type GitNetRuntime(config: GitNetConfig) =
8182 /// <param name =" message " >Message for commit</param >
8283 /// <param name =" date " >Date</param >
8384 /// <param name =" appendCommit " >Whether to append to last commit</param >
84- member this.CommitChanges (? username ,? email ,? message : string , ? date : DateTimeOffset , ? appendCommit : bool ) =
85+ /// <param name =" writeIndex " >Whether to write the index before committing. Default <c >true</c ></param >
86+ member this.CommitChanges (? username ,? email ,? message : string , ? date : DateTimeOffset , ? appendCommit : bool , ? writeIndex ) =
8587 let appendCommit = appendCommit |> Option.defaultValue commitHasBeenMade
8688 let username = defaultArg username " GitHub Action"
8789 let email = defaultArg email " 41898282+github-actions[bot]@users.noreply.github.com"
8890 let date = defaultArg date DateTimeOffset.Now
8991 let message = defaultArg message " [skip ci]\n\n GitNet auto file update."
92+ let writeIndex = defaultArg writeIndex true
9093 let signature = Signature( name = username, email = email, `` when `` = date)
9194 try
95+ if writeIndex then this.repo.Index.Write()
9296 this
9397 .repo
9498 .Commit( message, signature, signature, CommitOptions( AllowEmptyCommit = false , AmendPreviousCommit = appendCommit))
0 commit comments