Skip to content

Commit 05c9d4c

Browse files
authored
support uppercase check X in checklist (#11)
* support uppercase check X in checklist * disable github pr input tests
1 parent c616e3e commit 05c9d4c

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.github/workflows/checkmate.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
go-version: 1.19
3232
- run: go run main.go
3333
env:
34-
INPUT_PATHS: |
35-
"**/*.go":
36-
- <!--checkmate select=1-->
37-
- Dummy Test Item
38-
- Dummy Test Item 2
39-
README.md:
40-
- Test 1
41-
- Test 2
34+
# INPUT_PATHS: |
35+
# "**/*.go":
36+
# - <!--checkmate select=1-->
37+
# - Dummy Test Item
38+
# - Dummy Test Item 2
39+
# README.md:
40+
# - Test 1
41+
# - Test 2
4242
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pkg/checkmate/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ type block struct {
9696
}
9797

9898
func findChecklistBlocks(content string) (blocks []block) {
99-
re := regexp.MustCompile(`- \[[ x]\] .*`)
99+
re := regexp.MustCompile(`- \[[ xX]\] .*`)
100100

101101
matches := findRE(content, re)
102102

pkg/checkmate/parse_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,18 @@ func Test_findChecklistBlock(t *testing.T) {
253253
},
254254
},
255255
},
256+
{
257+
name: "UppercaseCheck",
258+
args: args{
259+
content: strings.ReplaceAll(ChecklistWithIndicator, "[x]", "[X]"),
260+
},
261+
expected: []block{
262+
{
263+
Raw: strings.ReplaceAll(checklistBlock, "[x]", "[X]"),
264+
LineNumbers: []int{11, 12, 13, 14, 15},
265+
},
266+
},
267+
},
256268
}
257269
for _, tt := range tests {
258270
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)