File tree Expand file tree Collapse file tree 3 files changed +39
-37
lines changed Expand file tree Collapse file tree 3 files changed +39
-37
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "problemMatcher" : [
3
+ {
4
+ "owner" : " markdownlint" ,
5
+ "pattern" : [
6
+ {
7
+ "code" : 3 ,
8
+ "file" : 1 ,
9
+ "line" : 2 ,
10
+ "message" : 4 ,
11
+ "regexp" : " ^(.+):(\\ d+)(?:\\ d+)? (\\ S+) (.+)$"
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
Original file line number Diff line number Diff line change @@ -26,15 +26,30 @@ jobs:
26
26
runs-on : ubuntu-latest
27
27
steps :
28
28
29
- - uses : ./
29
+ - name : Test problem matcher
30
+ id : expect-failure
31
+ uses : ./
32
+ with :
33
+ config_file : .markdownlintrc
34
+ files : .
35
+ rules : examples/rules/custom.js
36
+ env :
37
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38
+ continue-on-error : true
39
+ - if : ${{ steps.expect-failure.outcome != 'failure' }}
40
+ run : |
41
+ exit 1
42
+ - name : Test ignore_files
43
+ uses : ./
30
44
with :
31
45
config_file : .markdownlintrc
32
46
files : .
33
47
ignore_files : examples/ignore/*
34
48
rules : examples/rules/custom.js
35
49
env :
36
50
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37
- - uses : ./
51
+ - name : Test ignore_path
52
+ uses : ./
38
53
with :
39
54
config_file : .markdownlintrc
40
55
files : .
Original file line number Diff line number Diff line change @@ -6,41 +6,12 @@ MARKDOWNLINT="${MARKDOWNLINT}${INPUT_IGNORE_FILES:+ -i ${INPUT_IGNORE_FILES}}"
6
6
MARKDOWNLINT=" ${MARKDOWNLINT}${INPUT_IGNORE_PATH: + -p ${INPUT_IGNORE_PATH} } "
7
7
MARKDOWNLINT=" ${MARKDOWNLINT}${INPUT_RULES: + -r ${INPUT_RULES} } "
8
8
9
- # shellcheck disable=SC2086
10
- OUTPUT=$( ${MARKDOWNLINT} ${INPUT_FILES} 2>&1 )
11
- SUCCESS=$?
12
- echo " ${OUTPUT} "
13
-
14
- if [ ${SUCCESS} -eq 0 ]; then
15
- exit 0
16
- fi
17
-
18
- if [ " ${GITHUB_EVENT_NAME} " = pull_request ]; then
19
- comment=" "
20
- FILES=$( echo " ${OUTPUT} " | cut -d: -f1 | sort | uniq)
21
-
22
- for file in ${FILES} ; do
23
- comment=" ${comment} <details><summary><code>${file} </code></summary>
9
+ echo ' ::add-matcher::.github/markdownlint-problem-matcher.json'
24
10
25
- \`\`\`
26
- $( echo " ${OUTPUT} " | grep " ^${file} :" | sed " s/^[^:]*:[[:space:]]*//" )
27
- \`\`\`
28
-
29
- </details>"
30
- done
31
-
32
- COMMENT_BODY=" #### Issues with Markdown/CommonMark files
33
- ${comment}
34
-
35
- *Workflow: \` ${GITHUB_WORKFLOW} \` , Action: \` ${GITHUB_ACTION} \` *"
36
- PAYLOAD=$( echo ' {}' | jq --arg body " ${COMMENT_BODY} " ' .body = $body' )
37
- COMMENTS_URL=$( jq -r .pull_request.comments_url < " ${GITHUB_EVENT_PATH} " )
11
+ # shellcheck disable=SC2086
12
+ ${MARKDOWNLINT} ${INPUT_FILES}
13
+ readonly RC=$?
38
14
39
- curl -sS \
40
- -H " Authorization: token ${GITHUB_TOKEN} " \
41
- -H ' Content-Type: application/json' \
42
- -d " ${PAYLOAD} " \
43
- " ${COMMENTS_URL} " > /dev/null
44
- fi
15
+ echo ' ::remove-matcher owner=markdownlint::'
45
16
46
- exit ${SUCCESS }
17
+ exit ${RC }
You can’t perform that action at this time.
0 commit comments