8 Commits
1.0.0 ... 1.1.0

Author SHA1 Message Date
Alexey Alekhin
94e0aab03c feat: add format input and a single-line problem matcher (#40)
Co-authored-by: Joakim Sørensen <ludeeus@gmail.com>
2021-03-31 21:03:27 +02:00
Ludeeus
184a772465 Use correct branch for release-drafter 2021-03-31 20:53:27 +02:00
Ludeeus
f01a9171d3 Add Release Drafter 2021-03-31 20:52:44 +02:00
Alexey Alekhin
7fa8ae9d42 fix: multiline problem matcher (#39) 2021-03-31 15:55:33 +02:00
Josh Soref
f0d446b80e spelling: separated (#37)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-02-11 10:30:11 +01:00
Viktor Szépe
00209834e5 Add Display shellcheck version step (#36) 2021-01-16 23:47:30 +01:00
Justin Hammond
ac3e5d1ab4 Updates README to include ShellCheck flag/options usage (#35) 2021-01-13 18:26:27 +01:00
Simon Egersand
b247a9c05d Add ignore multiple dirs example (#33) 2020-12-24 12:06:42 +01:00
6 changed files with 92 additions and 16 deletions

18
.github/problem-matcher-gcc.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "shellcheck-gcc",
"pattern": [
{
"regexp": "^(.+):(\\d+):(\\d+):\\s(note|warning|error):\\s(.*)\\s\\[(SC\\d+)\\]$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}

View File

@@ -1,7 +1,7 @@
{ {
"problemMatcher": [ "problemMatcher": [
{ {
"owner": "shellcheck", "owner": "shellcheck-tty",
"pattern": [ "pattern": [
{ {
"regexp": "^In\\s(.+)\\sline\\s(\\d+):$", "regexp": "^In\\s(.+)\\sline\\s(\\d+):$",
@@ -14,9 +14,10 @@
{ {
"regexp": "(SC\\d+):\\s(.+)$", "regexp": "(SC\\d+):\\s(.+)$",
"code": 1, "code": 1,
"message": 2 "message": 2,
"loop": true
} }
] ]
} }
] ]
} }

8
.github/release-drafter.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
change-template: '- #$NUMBER $TITLE @$AUTHOR'
sort-direction: ascending
exclude-labels:
- "release-drafter-ignore"
template: |
## Whats Changed
$CHANGES

16
.github/workflows/release-drafter.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Release Drafter
on:
push:
branches:
- master
jobs:
release-drafter:
name: Release Drafter
runs-on: ubuntu-latest
steps:
- name: 🏃 Run Release Drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,9 +22,14 @@ jobs:
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
``` ```
## Globally disable checks ## ShellCheck options
To disable specific checks add it to a `SHELLCHECK_OPTS` env key in the job definition. You can pass any supported ShellCheck option or flag with the `SHELLCHECK_OPTS` env key in the job definition.
Some examples include:
* To disable specific checks (eg: `-e SC2059 -e SC2034 -e SC1090`)
* To test against different shells (eg: `-s dash` or `-s ksh`)
example: example:
@@ -42,7 +47,8 @@ You can use the `ignore` input to disable specific directories.
```text ```text
sample structure: sample structure:
sample/directory/with/files/toignore/test.sh sample/directory/with/files/ignoreme/test.sh
sample/directory/with/files/ignoremetoo/test.sh
sample/directory/with/files/test.sh sample/directory/with/files/test.sh
``` ```
@@ -53,10 +59,10 @@ example:
- name: Run ShellCheck - name: Run ShellCheck
uses: ludeeus/action-shellcheck@master uses: ludeeus/action-shellcheck@master
with: with:
ignore: toignore ignore: ignoreme ignoremetoo
``` ```
This will skip `sample/directory/with/files/toignore/test.sh` This will skip `sample/directory/with/files/ignoreme/test.sh` and `sample/directory/with/files/ignoremetoo/test.sh`
## Minimum severity of errors to consider (error, warning, info, style) ## Minimum severity of errors to consider (error, warning, info, style)
@@ -125,3 +131,19 @@ by setting `disable_matcher` to `true`.
with: with:
disable_matcher: true disable_matcher: true
``` ```
## Change output format
Shellcheck can print output in these formats: `checkstyle`, `diff`, `gcc`, `json`, `json1`, `quiet`, `tty`. See some examples [here](https://github.com/koalaman/shellcheck/wiki/Integration#pick-the-output-format-that-makes-your-life-easier).
Only `tty` and `gcc` produce file annotations via problem matcher, default is `gcc`.
- `tty` has multi-line log messages, but all annotations are reported as errors
- `gcc` has single-line log messages, so it's easier to parse with a problem matcher (including correct severity annotation)
```yaml
...
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
format: tty
```

View File

@@ -3,7 +3,7 @@ author: "Ludeeus <hi@ludeeus.dev>"
description: "GitHub action for ShellCheck." description: "GitHub action for ShellCheck."
inputs: inputs:
additional_files: additional_files:
description: "A space seperated list of additional filename to check" description: "A space separated list of additional filename to check"
required: false required: false
default: "" default: ""
ignore: ignore:
@@ -26,6 +26,10 @@ inputs:
description: "Set to true to skip using problem-matcher" description: "Set to true to skip using problem-matcher"
required: false required: false
default: "false" default: "false"
format:
description: "Output format (checkstyle, diff, gcc, json, json1, quiet, tty)"
required: false
default: "gcc"
outputs: outputs:
files: files:
description: A list of files with issues description: A list of files with issues
@@ -42,8 +46,9 @@ runs:
- name: Enable problem-matcher - name: Enable problem-matcher
shell: bash shell: bash
run: | run: |
if [[ ${{ inputs.disable_matcher }} != "true" ]]; then problem_matcher_file="${{ github.action_path }}/.github/problem-matcher-${{ inputs.format }}.json"
echo "::add-matcher::${{ github.action_path }}/.github/problem-matcher.json" if [[ ${{ inputs.disable_matcher }} != "true" && -f "$problem_matcher_file" ]]; then
echo "::add-matcher::$problem_matcher_file"
fi fi
- name: Download shellcheck - name: Download shellcheck
@@ -65,6 +70,11 @@ runs:
mv "${{ github.action_path }}/shellcheck-${scversion}/shellcheck" \ mv "${{ github.action_path }}/shellcheck-${scversion}/shellcheck" \
"${{ github.action_path }}/shellcheck" "${{ github.action_path }}/shellcheck"
- name: Display shellcheck version
shell: bash
run: |
"${{ github.action_path }}/shellcheck" --version
- name: Set options - name: Set options
shell: bash shell: bash
id: options id: options
@@ -73,6 +83,7 @@ runs:
if [[ -n "${{ inputs.severity }}" ]]; then if [[ -n "${{ inputs.severity }}" ]]; then
options+=("-S ${{ inputs.severity }}") options+=("-S ${{ inputs.severity }}")
fi fi
options+=("--format=${{ inputs.format }}")
echo "::set-output name=options::${options[@]}" echo "::set-output name=options::${options[@]}"
- name: Gather excluded paths - name: Gather excluded paths