Skip to content

Commit d526029

Browse files
committed
chore: make release process skip invalid commits
1 parent 57dba51 commit d526029

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

build/Commands/Release.fs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ let private parseCommitMessage (commitMsg: string) =
6363
Description = m.Groups.["description"].Value
6464
BreakingChange = m.Groups.["breakingChange"].Success
6565
}
66+
|> Ok
6667

6768
else
68-
failwith
69+
Error
6970
$"Invalid commit message format.
7071
7172
Expected a commit message with the following format: <type>[optional scope]: <description>
@@ -151,13 +152,18 @@ type ReleaseCommand() =
151152

152153
let releaseCommits =
153154
commits
154-
// Parse the commit to get the commit information
155+
// Parse the commit to get the commit information (ignore invalid commits)
155156
|> Seq.map (fun commit ->
156-
{|
157-
Commit = commit
158-
CommitMessage = parseCommitMessage commit.MessageShort
159-
|}
157+
match parseCommitMessage commit.MessageShort with
158+
| Ok commitMessage ->
159+
Some {|
160+
Commit = commit
161+
CommitMessage = commitMessage
162+
|}
163+
| Error _ -> None
160164
)
165+
|> Seq.filter Option.isSome
166+
|> Seq.map Option.get
161167
// Remove commits that don't trigger a release
162168
|> Seq.filter (fun commit ->
163169
match commit.CommitMessage.Type with
@@ -345,6 +351,4 @@ type ReleaseCommand() =
345351

346352
Command.Run("git", "push")
347353

348-
// PublishCommand().Execute(context, PublishSettings(SkipBuild = true)) |> ignore
349-
350354
0

0 commit comments

Comments
 (0)