Skip to content

Commit

Permalink
build: annotate markdown lint failures in pull requests
Browse files Browse the repository at this point in the history
Add a problem matcher for output from remark-lint to our lint-md GitHub
Actions CI workflow so that any markdown linter failures are annotated
in the pull request in the web UI.

Signed-off-by: Richard Lau <[email protected]>

PR-URL: #32391
Refs: https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md
Refs: https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
  • Loading branch information
richardlau authored and MylesBorins committed Mar 25, 2020
1 parent 4ca3030 commit 81183ca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ jobs:
with:
node-version: 10.x
- name: Lint docs
run: NODE=$(which node) make lint-md
run: |
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
NODE=$(which node) make lint-md
lint-js:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/remark-lint-problem-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "remark-lint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)*$",
"file": 1
},
{
"regexp": "^\\s+(?:\\d+:\\d+-)?(\\d+):(\\d+)\\s+\\S*(error|warning|info)\\S*\\s+(.+)\\s+(\\S+)\\s+(?:\\S+)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}

0 comments on commit 81183ca

Please sign in to comment.