mirror of
https://github.com/ludeeus/action-shellcheck.git
synced 2025-09-16 21:26:27 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
94e0aab03c | ||
![]() |
184a772465 | ||
![]() |
f01a9171d3 | ||
![]() |
7fa8ae9d42 | ||
![]() |
f0d446b80e | ||
![]() |
00209834e5 | ||
![]() |
ac3e5d1ab4 | ||
![]() |
b247a9c05d |
18
.github/problem-matcher-gcc.json
vendored
Normal file
18
.github/problem-matcher-gcc.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -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
8
.github/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
change-template: '- #$NUMBER $TITLE @$AUTHOR'
|
||||||
|
sort-direction: ascending
|
||||||
|
exclude-labels:
|
||||||
|
- "release-drafter-ignore"
|
||||||
|
template: |
|
||||||
|
## What’s Changed
|
||||||
|
|
||||||
|
$CHANGES
|
16
.github/workflows/release-drafter.yml
vendored
Normal file
16
.github/workflows/release-drafter.yml
vendored
Normal 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 }}
|
32
README.md
32
README.md
@@ -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
|
||||||
|
```
|
||||||
|
17
action.yaml
17
action.yaml
@@ -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
|
||||||
|
Reference in New Issue
Block a user