luizm / action-sh-checker Goto Github PK
View Code? Open in Web Editor NEWA GitHub action that performs static analysis for shell scripts using shellcheck, shfmt and checkbashisms.
License: MIT License
A GitHub action that performs static analysis for shell scripts using shellcheck, shfmt and checkbashisms.
License: MIT License
Build: 627796069
Output:
Validating shell scripts files using shellcheck
The files above have some shellcheck issues
Nothing more in raw logs.
Config file:
# yamllint disable rule:line-length
---
name: Lint
on:
- pull_request
- push
jobs:
ShellCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Shell Check
uses: luizm/action-sh-checker@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHELLCHECK_OPTS: -e SC1004,SC1083,SC1090,SC1091,SC1117,SC2004,SC2005,SC2015,SC2027,SC2032,SC2033,SC2034,SC2035,SC2046,SC2068,SC2070,SC2071,SC2086,SC2091,SC2103,SC2116,SC2124,SC2128,SC2145,SC2154,SC2155,SC2162,SC2164,SC2166,SC2181,SC2188,SC2206,SC2221,SC2222,SC2230
with:
sh_checker_comment: true
sh_checker_shfmt_disable: true
Using 0.1.4
of this action breaks the build with the following error message:
Please update to the new URL:
https://github.com/koalaman/shellcheck/releases/download/v0.7.0/shellcheck-v0.7.0.linux.x86_64.tar.xz
For more information, see:
https://github.com/koalaman/shellcheck/issues/1871
PS: Sorry for breaking your build. The hosting costs were getting out of hand :(
Should be a quick fix, thanks!
As per README, I've added the following inputs:
- name: Shell Check
uses: luizm/action-sh-checker@master
with:
sh_checker_comment: true
sh_checker_shfmt_disable: true
However they're not defined in "action.yml" and GitHub complains about it in Annotations section:
Unexpected input 'sh_checker_comment', valid inputs are ['']
Unexpected input 'sh_checker_shfmt_disable', valid inputs are ['']
Build: 113278948
Sometime it's important to run checkbashisms for portable / posix compatible shell scripts.
checkbashisms can be installed on debian based dists via:
apt-get install -qq devscripts
There is also a package on alpine repository: https://pkgs.alpinelinux.org/package/edge/main/x86/checkbashisms
There is a new release version 3.3.0 but this action is still using 3.2.4
I am getting this Warning during action build. (use the v.0.1.5)
https://github.com/hellresistor/BCNA-Installer/runs/643824056?check_suite_focus=true
Line: 80
WARNING: Ignoring APKINDEX.70f61090.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.ca2fea5b.tar.gz: No such file or directory
I am trying apply your action on one of my shellscripts but are saying "No shell scripts found"
.yml file: https://github.com/hellresistor/BCNA-Installer/actions/runs/95515052/workflow
Maybe issue because my script filename contains a " - " ?!
Are you working on V0.1.5 , right? are happening with v0.1.4 too (tooo slow) :|
The action was working yesterday and now it just crashes when I launch it due to a tar error on shellcheck archive decompression.
Version where bug occurs: 0.1.9 and 0.1.8
here is the log for the 0.1.9
2021-01-15T09:01:32.5574788Z Download action repository 'actions/checkout@v2'
2021-01-15T09:01:34.8836149Z Download action repository 'luizm/[email protected]'
2021-01-15T09:01:35.2618010Z ##[group]Build container for action use: '/home/runner/work/_actions/luizm/action-sh-checker/v0.1.9/Dockerfile'.
2021-01-15T09:01:35.2684437Z ##[command]/usr/bin/docker build -t cc4956:83d57e2ebf9e4bf6ab3bc459742dddc1 -f "/home/runner/work/_actions/luizm/action-sh-checker/v0.1.9/Dockerfile" "/home/runner/work/_actions/luizm/action-sh-checker/v0.1.9"
2021-01-15T09:01:36.0550143Z Sending build context to Docker daemon 13.31kB
2021-01-15T09:01:36.0551520Z
2021-01-15T09:01:36.0928197Z Step 1/9 : FROM alpine:latest
2021-01-15T09:01:37.3662899Z latest: Pulling from library/alpine
2021-01-15T09:01:37.4590932Z 596ba82af5aa: Pulling fs layer
2021-01-15T09:01:38.3852333Z 596ba82af5aa: Verifying Checksum
2021-01-15T09:01:38.3853575Z 596ba82af5aa: Download complete
2021-01-15T09:01:38.3854395Z 596ba82af5aa: Pull complete
2021-01-15T09:01:38.3855390Z Digest: sha256:d9a7354e3845ea8466bb00b22224d9116b183e594527fb5b6c3d30bc01a20378
2021-01-15T09:01:38.3856561Z Status: Downloaded newer image for alpine:latest
2021-01-15T09:01:38.3857178Z ---> 7731472c3f2a
2021-01-15T09:01:38.3857743Z Step 2/9 : LABEL "name"="sh-checker"
2021-01-15T09:01:38.6490020Z ---> Running in c597ef5a9dca
2021-01-15T09:01:39.0058997Z Removing intermediate container c597ef5a9dca
2021-01-15T09:01:39.0060526Z ---> ed6f6c0861cc
2021-01-15T09:01:39.0061666Z Step 3/9 : LABEL "maintainer"="Luiz Muller <[email protected]>"
2021-01-15T09:01:39.0157071Z ---> Running in 6cb2cee09f32
2021-01-15T09:01:40.0075570Z Removing intermediate container 6cb2cee09f32
2021-01-15T09:01:40.0096237Z ---> 5e34441cacf6
2021-01-15T09:01:40.0097552Z Step 4/9 : ARG shfmt_version=3.0.1
2021-01-15T09:01:40.0167764Z ---> Running in d70bc932c074
2021-01-15T09:01:41.0058980Z Removing intermediate container d70bc932c074
2021-01-15T09:01:41.0059812Z ---> a93351daee89
2021-01-15T09:01:41.0078182Z Step 5/9 : ARG shellcheck_version=0.7.1
2021-01-15T09:01:41.0212359Z ---> Running in 615635bb195f
2021-01-15T09:01:42.0074446Z Removing intermediate container 615635bb195f
2021-01-15T09:01:42.0075079Z ---> 86756b2260fa
2021-01-15T09:01:42.0077229Z Step 6/9 : RUN apk add --no-cache bash jq curl checkbashisms && apk add --no-cache --virtual .build-deps tar && wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt && wget "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/shellcheck-v${shellcheck_version}.linux.x86_64.tar.xz" -O- | tar xJ -C /usr/local/bin/ --strip-components=1 --wildcards '*/shellcheck' && chmod +x /usr/local/bin/shellcheck && apk del --no-cache .build-deps && rm -rf /tmp/*
2021-01-15T09:01:42.0159977Z ---> Running in c864728a9863
2021-01-15T09:01:42.3612743Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
2021-01-15T09:01:42.4592768Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
2021-01-15T09:01:42.6221109Z (1/14) Installing ncurses-terminfo-base (6.2_p20210109-r0)
2021-01-15T09:01:42.6441281Z (2/14) Installing ncurses-libs (6.2_p20210109-r0)
2021-01-15T09:01:42.6800338Z (3/14) Installing readline (8.1.0-r0)
2021-01-15T09:01:42.6886482Z (4/14) Installing bash (5.1.0-r0)
2021-01-15T09:01:42.7104792Z Executing bash-5.1.0-r0.post-install
2021-01-15T09:01:42.7124002Z (5/14) Installing libbz2 (1.0.8-r1)
2021-01-15T09:01:42.7193844Z (6/14) Installing perl (5.32.0-r0)
2021-01-15T09:01:43.0107460Z (7/14) Installing checkbashisms (2.20.5-r0)
2021-01-15T09:01:43.0219669Z (8/14) Installing ca-certificates (20191127-r5)
2021-01-15T09:01:43.0380916Z (9/14) Installing brotli-libs (1.0.9-r3)
2021-01-15T09:01:43.0504962Z (10/14) Installing nghttp2-libs (1.42.0-r1)
2021-01-15T09:01:43.0579897Z (11/14) Installing libcurl (7.74.0-r0)
2021-01-15T09:01:43.0687268Z (12/14) Installing curl (7.74.0-r0)
2021-01-15T09:01:43.0781376Z (13/14) Installing oniguruma (6.9.6-r0)
2021-01-15T09:01:43.0888837Z (14/14) Installing jq (1.6-r1)
2021-01-15T09:01:43.1020263Z Executing busybox-1.32.1-r0.trigger
2021-01-15T09:01:43.1071236Z Executing ca-certificates-20191127-r5.trigger
2021-01-15T09:01:43.1428099Z OK: 49 MiB in 28 packages
2021-01-15T09:01:43.1809822Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
2021-01-15T09:01:43.4580573Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
2021-01-15T09:01:43.7412868Z (1/3) Installing libacl (2.2.53-r0)
2021-01-15T09:01:43.7641147Z (2/3) Installing tar (1.33-r1)
2021-01-15T09:01:43.7938468Z (3/3) Installing .build-deps (20210115.090143)
2021-01-15T09:01:43.7948537Z Executing busybox-1.32.1-r0.trigger
2021-01-15T09:01:43.7976527Z OK: 49 MiB in 31 packages
2021-01-15T09:01:43.8318649Z �[91mConnecting to github.com (140.82.112.4:443)
2021-01-15T09:01:43.8786477Z �[0m�[91mConnecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.217.83.140:443)
2021-01-15T09:01:43.9329799Z �[0m�[91msaving to '/usr/local/bin/shfmt'
2021-01-15T09:01:43.9794751Z �[0m�[91mshfmt �[0m�[91m100% �[0m�[91m|********************************| �[0m�[91m2944k�[0m�[91m 0:00:00 ETA�[0m�[91m
2021-01-15T09:01:43.9795327Z �[0m�[91m'/usr/local/bin/shfmt' saved
2021-01-15T09:01:43.9812968Z �[0m�[91mtar (grandchild): xz: Cannot exec: No such file or directory
2021-01-15T09:01:43.9813684Z tar (grandchild): Error is not recoverable: exiting now�[0m�[91m
2021-01-15T09:01:43.9825640Z �[0m�[91mConnecting to github.com (140.82.112.3:443)
2021-01-15T09:01:44.0432364Z �[0m�[91mConnecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.145.123:443)
2021-01-15T09:01:44.1080204Z �[0m�[91mwriting to stdout
2021-01-15T09:01:44.1083668Z �[0m�[91mtar: Child died with signal 13
2021-01-15T09:01:44.1084424Z tar: Error is not recoverable: exiting now
2021-01-15T09:01:44.9416978Z The command '/bin/sh -c apk add --no-cache bash jq curl checkbashisms && apk add --no-cache --virtual .build-deps tar && wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt && wget "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/shellcheck-v${shellcheck_version}.linux.x86_64.tar.xz" -O- | tar xJ -C /usr/local/bin/ --strip-components=1 --wildcards '*/shellcheck' && chmod +x /usr/local/bin/shellcheck && apk del --no-cache .build-deps && rm -rf /tmp/*' returned a non-zero code: 2
2021-01-15T09:01:44.9433002Z �[0m
2021-01-15T09:01:44.9455096Z ##[warning]Docker build failed with exit code 2, back off 3.493 seconds before retry.
Registering a problem matcher like https://github.com/ludeeus/action-shellcheck/blob/master/.github/problem-matcher.json can let GitHub put inline comments on the Files tab of a PR
Hello, first of all thank you for the action, it has been really useful!
I've recently added this action to a repository and it is working fine, except for the fact that when a test fails no comments are posted to the PR even though sh_checker_comment
is set to true.
Is there something else that needs to be done? Thank you for your time!
action configuration: https://github.com/kworkflow/kworkflow/blob/unstable/.github/workflows/shfmt.yml
action failing in a pr but no comment from the bot: kworkflow/kworkflow#324
Hi, the action docker image cannot be built since recently :
Step 1/9 : FROM alpine:latest
latest: Pulling from library/alpine
596ba82af5aa: Pulling fs layer
596ba82af5aa: Verifying Checksum
596ba82af5aa: Download complete
596ba82af5aa: Pull complete
Digest: sha256:d9a7354e3845ea8466bb00b22224d9116b183e594527fb5b6c3d30bc01a20378
Status: Downloaded newer image for alpine:latest
---> 7731472c3f2a
Step 2/9 : LABEL "name"="sh-checker"
---> Running in 35c5543f9fa3
Removing intermediate container 35c5543f9fa3
---> 38c3a14837f3
Step 3/9 : LABEL "maintainer"="Luiz Muller <[email protected]>"
---> Running in 1485bfcd9e8f
Removing intermediate container 1485bfcd9e8f
---> d6f6f463d9ae
Step 4/9 : ARG shfmt_version=3.0.1
---> Running in 24ce2dce2508
Removing intermediate container 24ce2dce2508
---> 670074253401
Step 5/9 : ARG shellcheck_version=0.7.1
---> Running in 839c645230f2
Removing intermediate container 839c645230f2
---> a678fc1408e8
Step 6/9 : RUN apk add --no-cache bash jq curl && apk add --no-cache --virtual .build-deps tar && wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt && wget "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/shellcheck-v${shellcheck_version}.linux.x86_64.tar.xz" -O- | tar xJ -C /usr/local/bin/ --strip-components=1 --wildcards '*/shellcheck' && chmod +x /usr/local/bin/shellcheck && apk del --no-cache .build-deps && rm -rf /tmp/*
---> Running in 4a05f33c7e7f
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/11) Installing ncurses-terminfo-base (6.2_p20210109-r0)
(2/11) Installing ncurses-libs (6.2_p20210109-r0)
(3/11) Installing readline (8.1.0-r0)
(4/11) Installing bash (5.1.0-r0)
Executing bash-5.1.0-r0.post-install
(5/11) Installing ca-certificates (20191127-r5)
(6/11) Installing brotli-libs (1.0.9-r3)
(7/11) Installing nghttp2-libs (1.42.0-r1)
(8/11) Installing libcurl (7.74.0-r0)
(9/11) Installing curl (7.74.0-r0)
(10/11) Installing oniguruma (6.9.6-r0)
(11/11) Installing jq (1.6-r1)
Executing busybox-1.32.1-r0.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 11 MiB in 25 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libacl (2.2.53-r0)
(2/3) Installing tar (1.33-r1)
(3/3) Installing .build-deps (20210122.013631)
Executing busybox-1.32.1-r0.trigger
OK: 12 MiB in 28 packages
Connecting to github.com (192.30.255.113:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.217.70.100:443)
saving to '/usr/local/bin/shfmt'
shfmt 5% |* | 152k 0:00:18 ETA
shfmt 100% |********************************| 2944k 0:00:00 ETA
'/usr/local/bin/shfmt' saved
tar (grandchild): xz: Cannot exec: No such file or directory
tar (grandchild): Error is not recoverable: exiting now
Connecting to github.com (192.30.255.113:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.217.15.44:443)
writing to stdout
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
The command '/bin/sh -c apk add --no-cache bash jq curl && apk add --no-cache --virtual .build-deps tar && wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt && wget "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/shellcheck-v${shellcheck_version}.linux.x86_64.tar.xz" -O- | tar xJ -C /usr/local/bin/ --strip-components=1 --wildcards '*/shellcheck' && chmod +x /usr/local/bin/shellcheck && apk del --no-cache .build-deps && rm -rf /tmp/*' returned a non-zero code: 2
Hi,
i'm running the action like this:
- name: Run the sh-checker
uses: luizm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHELLCHECK_OPTS: -x
with:
sh_checker_comment: true
sh_checker_exclude: "tests/assets tests/bats"
sh_checker_checkbashisms_enable: true
on repo: https://github.com/jkroepke/helm-secrets
dependabot opens a PR to bump the action, which is currently failing: https://github.com/jkroepke/helm-secrets/runs/7444254384?check_suite_focus=true
And here is an output from main branch: https://github.com/jkroepke/helm-secrets/runs/7296253846?check_suite_focus=true
sh-checker is finding 47 shell scripts instead 31. It looks like the newer shfmt include the bats files from the repository.
Now checkbashisms
is confused, since it throws errors like script tests/unit/view.bats does not appear to be a /bin/sh script; skipping
and the action will fail.
Hi, I have a problem getting this to work. The shfmt portion works fine, but shellcheck does not report any problems.
I'm using luizm/[email protected]
as any prior version fails with a tar
error. Tried a few different combinations of actions/checkout@v1/v2
and purposedly-placed bad lines in shell scripts in various locations.
I kind of dumped a minimal reproducible occurance of shellcheck not seeming to do anything into the Repository I was working on, if that's not good enough I'll go and make a separate one. It's not picking up anything regardless of file location, extension and shebang.
Excerpt from my Github workflow file:
# .github/workflows/ci.yml
on:
...
jobs:
lint-shell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: luizm/[email protected]
build-and-test:
needs: lint-shell
...
These lines are taken straight from the shellcheck readme as examples of things that'd cause its checks to fail:
#!/bin/bash
echo $@
rm "~/my file.txt"
time --format=%s sleep 10
echo "$(date)"
My Repository's structure is as follows:
project:
- test # placed to trigger shellcheck failure
- test.bash # placed to trigger shellcheck failure
- test.sh # placed to trigger shellcheck failure
- bin: # errors in these files are not detected either
- download
- install
- list-all
Action output can be found here: https://github.com/itspngu/asdf-mongo-tools/runs/1756792955#step:4:5
/usr/bin/docker run --name ab6e4131b5d1414baaf756b12a7fe50d_ada86f --label 442333 --workdir /github/workspace --rm -e INPUT_SH_CHECKER_EXCLUDE -e INPUT_SH_CHECKER_SHFMT_DISABLE -e INPUT_SH_CHECKER_SHELLCHECK_DISABLE -e INPUT_SH_CHECKER_CHECKBASHISMS_ENABLE -e INPUT_SH_CHECKER_COMMENT -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/asdf-mongo-tools/asdf-mongo-tools":"/github/workspace" 442333:ab6e4131b5d1414baaf756b12a7fe50d
Validating shell scripts files using shellcheck
Validating shell scripts files using shfmt
--- bin/install.orig
+++ bin/install
@@ -1,36 +1,36 @@
#!/usr/bin/env bash
set -e
[ -n "$ASDF_INSTALL_PATH" ] || (
echo "Missing ASDF_INSTALL_PATH" 1>&2 &&
exit 1
)
[ "$ASDF_INSTALL_TYPE" == "version" ] || (
echo "asdf-mongo-tools supports release installs only" 1>&2 &&
exit 1
)
# shellcheck source=bin/download
[ -x "$ASDF_DOWNLOAD_PATH/src/github.com/mongodb/mongo-tools/build.sh" ] || . "$(dirname "$0")/download"
GOBIN="$ASDF_INSTALL_PATH/bin"
[ -n "$GOROOT" ] || GOROOT="$(go env GOROOT)"
export GOBIN GOROOT
echo $@
(
- mkdir -p "$ASDF_INSTALL_PATH/bin" && \
- cd "$ASDF_DOWNLOAD_PATH/src/github.com/mongodb/mongo-tools" && \
- ./build.sh ssl sasl && \
- echo "mongo-tools have been installed."
+ mkdir -p "$ASDF_INSTALL_PATH/bin" &&
+ cd "$ASDF_DOWNLOAD_PATH/src/github.com/mongodb/mongo-tools" &&
+ ./build.sh ssl sasl &&
+ echo "mongo-tools have been installed."
) || (
rm -rf "$ASDF_INSTALL_PATH" "$ASDF_DOWNLOAD_PATH" &&
echo "An error ocurred while installing mongo-tools $ASDF_INSTALL_VERSION" 1>&2 &&
exit 1
)
The files above have some formatting problems, you can use `shfmt -w` to fix them
Would appreciate any help, I'm 99% sure I'm missing something obvious, but neither the readme for your action nor entrypoint.sh
got me any further.
Cheers
tar is downloaded successfully, but couldn't extract successfully.
Here is the error log:
Connecting to github.com (140.82.121.3:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.129.107:443)
saving to '/usr/local/bin/shfmt'
shfmt 100% |********************************| 2944k 0:00:00 ETA
'/usr/local/bin/shfmt' saved
tar (grandchild): xz: Cannot exec: No such file or directory
tar (grandchild): Error is not recoverable: exiting now
Connecting to github.com (140.82.121.4:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.232.91:443)
writing to stdout
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
The command '/bin/sh -c apk add --no-cache bash jq curl checkbashisms && apk add --no-cache --virtual .build-deps tar && wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt && wget "https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/shellcheck-v${shellcheck_version}.linux.x86_64.tar.xz" -O- | tar xJ -C /usr/local/bin/ --strip-components=1 --wildcards '*/shellcheck' && chmod +x /usr/local/bin/shellcheck && apk del --no-cache .build-deps && rm -rf /tmp/*' returned a non-zero code: 2
Warning: Docker build failed with exit code 2, back off 8.855 seconds before retry.
/usr/bin/docker build -t cc4956:4e3be1234fb04b18bf60cd1828b2478a -f "/home/runner/work/_actions/luizm/action-sh-checker/v0.1.9/Dockerfile" "/home/runner/work/_actions/luizm/action-sh-checker/v0.1.9"
Sending build context to Docker daemon 13.31kB
2020-05-03T16:23:48.4552672Z Validating shell scripts files using shellcheck
2020-05-03T16:23:48.4552829Z
2020-05-03T16:23:50.0944257Z Cleaning up orphan processes
Similar to #8
Same when running with act
:
$ act -j ShellCheck
...
[Lint/ShellCheck] 🐳 docker run image=act-luizm-action-sh-checker-master:latest entrypoint=[] cmd=[]
| Validating shell scripts files using shellcheck
|
[Lint/ShellCheck] ❌ Failure - Shell Check
Error: exit with `FAILURE`: 1
I'm using the bats-core framework,https://github.com/bats-core/bats-core and I'm locally using shellcheck for checking these scripts - by convention they have the .bats-extension). Would be great if this action allowed picking them up too. Bats is a fairly spread test framework so it is not a super special case IMHO.
Suggestion for solutions: Either autopick up the .bats extension also, or (more work?) by allowing the user to configure extensions that should be picked up for checking.
Thanks for the action btw!
Got the following error:
Validating shell scripts files using shfmt
Invalid number: 2230
The files above have some shellcheck issues
--- <standard input>.orig
+++ <standard input>
@@ -1,1 +1,2 @@
+
The files above have some formatting problems, you can use `shfmt -w` to fix them
Not sure why it's checking a standard input.
Build: 627458302
SSIA
Thank you!
Would be great to have a new release with the checkbashisms
support in place :)
Hi.
Have tried today your action!
are not work properly, or my mistake?
https://github.com/hellresistor/WorkFlowShell/runs/639392470?check_suite_focus=true
my main.yml:
`name: ShellCheck
on:
push:
branches:
- master
pull_request:
jobs:
shchecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run the sh-checker
uses: luizm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHELLCHECK_OPTS: -e SC1004 # It is posible to exclude some shellcheck warnings.
with:
sh_checker_comment: true
sh_checker_exclude: ".terraform ^dir/example.sh"`
After copy-pasting your example, the action print the following message
You are downloading ShellCheck from an outdated URL!
Validating shell scripts files using shellcheck
Validating shell scripts files using shfmt
Please update to the new URL:
https://github.com/koalaman/shellcheck/releases/download/v0.7.0/shellcheck-v0.7.0.linux.x86_64.tar.xz
For more information, see:
comment
https://github.com/koalaman/shellcheck/issues/1871
PS: Sorry for breaking your build. The hosting costs were getting out of hand :(
Commenting on the pull request
I'd like to only check the files that got changed in a PR. We have ~200 shell scripts in our server toolbox and a single unformatted/unshellchecked file will mark a PR as a fail, regardless of it being touched or not.
Is there a way to do this currently? If not, would it be possible to only check files which are listed in the diff of the PR against the branch it is being merged into?
Thanks in advance!
SHELLCHECK_OPT is not used anywhere so we can't pass any options to shellcheck ...
Build: 644229756 is green, but...
GHA comment suggests something else on the EA31337/EA-Tester/pull/181 PR:
It suggests there are no errors:
No errors or shellcheck is disabled
but the next line suggests that there are some issues:
The files above have some shellcheck issues.
Same for shfmt:
No errors or shfmt is disabled
but the next line suggests that there are some formatting problems.
Maybe the action shouldn't comment anything on no errors?
Also, it would be great to show which build triggered the comment (GH-14).
It would be useful to know which build triggered the comment, so some link to the build within the comment can help.
Correct Code (Passed in ShellCheck)
MyBalR=$(echo "$MyBal" | awk '{printf("%d\n",$1 + 0.5)}')
Get this on action-sh-checker v0.1.5 (and4 too) (are doing the \n on checking instead read it)
MyBalR=$(echo "$MyBal" | awk '{printf("%d
",$1 + 0.5)}')
^----^ SC2034: MyBalR appears unused. Verify use (or export if used externally).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.