Skip to content

Commit c941965

Browse files
authored
Merge pull request #9 from FsharpGHActions/fix-values-to-take
Fix values to take
2 parents 4f5e7de + 5c455a3 commit c941965

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.github/workflows/release-fsharp.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
name: Release F#
55

66
on:
7-
workflow_dispatch:
8-
# push:
9-
# tags:
10-
# - '*'
7+
workflow_dispatch: # xxx
8+
push:
9+
tags:
10+
- '*'
1111

1212
permissions:
1313
contents: write

src/Program.fs

+7-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ type RETURN_CODE =
3838
| SUCCESS = 0
3939
| FAIL = 1
4040

41+
let truncate (valuesToTake: int) (args: string array) : string array =
42+
match valuesToTake = -1 with
43+
| true -> args
44+
| false -> args |> Array.truncate valuesToTake
45+
4146
let getWorkflowNewPath () =
4247
Path.Combine [| Directory.GetCurrentDirectory(); "workflow.new.yml" |]
4348

@@ -65,11 +70,10 @@ let main (args: string array) : int =
6570
let! workflowKey = GitHubHelpers.getWorkflowKey ()
6671

6772
let tags =
68-
match valuesToTake = -1 with
69-
| true -> args
70-
| false -> args |> Array.truncate valuesToTake
73+
args
7174
|> Array.map (fun s -> s.Split(' ') |> Array.filter (String.IsNullOrEmpty >> not))
7275
|> Array.concat // flat
76+
|> truncate valuesToTake
7377

7478
do! Validations.validateTagsAreNotEmpty tags
7579

0 commit comments

Comments
 (0)