Skip to content

Commit

Permalink
Pass an array of labels instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
grunweg committed Aug 30, 2024
1 parent a0e3e55 commit 2311d38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/check-title-labels.lean
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def validate_title(title: String) : IO UInt32 := do
Check if a combination of PR labels is considered contradictory.
`labels` contains the names of this PR's labels.
-/
def has_contradictory_labels(labels : List String) : Bool := Id.run do
def has_contradictory_labels(labels : Array String) : Bool := Id.run do
-- Combine common labels.
let substitutions := [
("ready-to-merge", "bors"), ("auto-merge-after-CI", "bors"),
Expand Down Expand Up @@ -85,8 +85,7 @@ open Cli in
The exit code is the number of violations found. -/
def checkTitleLabelsCLI (args : Parsed) : IO UInt32 := do
let title := (args.positionalArg! "title").value
let labels : String := (args.positionalArg! "labels").value
let labels := labels.splitOn " "
let labels : Array String := args.variableArgsAs! String
let mut numberErrors := 0
if !labels.contains "WIP" then
-- We do not complain about WIP PRs.
Expand All @@ -102,6 +101,7 @@ def checkTitleLabelsCLI (args : Parsed) : IO UInt32 := do
numberErrors := numberErrors + 1
return numberErrors


open Cli in
/-- Setting up command line options and help text for `lake exe check-title-labels`. -/
def checkTitleLabels : Cmd := `[Cli|
Expand All @@ -112,7 +112,7 @@ def checkTitleLabels : Cmd := `[Cli|

ARGS:
title : String; "this PR's title"
labels : String; "space-separated list of label names of this PR"
...labels : Array String; "list of label names of this PR"
]

/-- The entrypoint to the `lake exe check-title-labels` command. -/
Expand Down

0 comments on commit 2311d38

Please sign in to comment.