diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d53bc72 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM bash:5 +COPY entrypoint.sh / +COPY problem-matcher.json / +COPY splinter / +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..fb96168 --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +name: 'Splinter' +description: 'Simple pattern-based linter' +inputs: + rules_file: + description: 'Rules file path' + required: true + default: '.splinter' + src_paths: + description: 'List of files/directories to lint' + required: false +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.rules_file }} + - ${{ inputs.src_paths }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..c62b9d7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cp /problem-matcher.json $HOME +echo "::add-matcher::$HOME/problem-matcher.json" +/splinter "$@" diff --git a/problem-matcher.json b/problem-matcher.json new file mode 100644 index 0000000..a73aa4f --- /dev/null +++ b/problem-matcher.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "owner": "splinter", + "pattern": [ + { + "regexp": "^(.+):(\\d+):(.+)$", + "file": 1, + "line": 2, + "message": 3 + } + ] + } + ] +}