Skip to content

Commit

Permalink
Fix log output by using a proble matcher instead (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Jul 14, 2021
1 parent 0f91319 commit 4717106
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ RUN \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY entrypoint.sh /entrypoint.sh
COPY matcher.json /matcher.json

ENTRYPOINT ["/entrypoint.sh"]
10 changes: 8 additions & 2 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/usr/bin/env bash
declare -a options

# This is a GitHub Action... Act like it :)
options+=(--format github)
# Use standard formatting, the GitHub Action annotation is nice, but
# hides information from the logs. This action uses standard output
# with a problem matcher instead.
options+=(--format standard)

# Register problem matcher
cp /matcher.json "${PWD}/matcher.json"
echo "::add-matcher::matcher.json"

# Custom path for yamllint configuration input
if [[ -n "${INPUT_CONFIG}" ]]; then
Expand Down
22 changes: 22 additions & 0 deletions src/matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "yamllint",
"pattern": [
{
"regexp": "^(.*\\.ya?ml)$",
"file": 1
},
{
"regexp": "^\\s{2}(\\d+):(\\d+)\\s+(error|warning)\\s+(.*?)\\s+\\((.*)\\)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}

0 comments on commit 4717106

Please sign in to comment.