From 2d364e111f280f78fd6a5b9b32b313a14ba475a7 Mon Sep 17 00:00:00 2001 From: Floris van der Grinten Date: Thu, 20 May 2021 17:12:12 +0200 Subject: [PATCH] Add ShellCheck workflow --- .github/workflows/lint.yml | 10 ++++++++++ configure/entrypoint.sh | 5 +++-- entrypoint.sh | 1 + tests/assert-env-set.sh | 3 +++ tests/assert-env-unset.sh | 3 +++ 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..cc3c745 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,10 @@ +on: pull_request +name: Lint + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ShellCheck + uses: ludeeus/action-shellcheck@1.1.0 diff --git a/configure/entrypoint.sh b/configure/entrypoint.sh index 97d0853..a0a4494 100755 --- a/configure/entrypoint.sh +++ b/configure/entrypoint.sh @@ -1,15 +1,16 @@ #!/bin/bash +# shellcheck disable=SC2086 set -e # Capture Connect configuration in $GITHUB_ENV, giving (optional) inputs # precendence over OP_CONNECT_* environment variables. -OP_CONNECT_HOST=${INPUT_CONNECT_HOST:-$OP_CONNECT_HOST} +OP_CONNECT_HOST="${INPUT_CONNECT_HOST:-$OP_CONNECT_HOST}" if [ -n "$OP_CONNECT_HOST" ]; then echo "OP_CONNECT_HOST=$OP_CONNECT_HOST" >> $GITHUB_ENV fi -OP_CONNECT_TOKEN=${INPUT_CONNECT_TOKEN:-$OP_CONNECT_TOKEN} +OP_CONNECT_TOKEN="${INPUT_CONNECT_TOKEN:-$OP_CONNECT_TOKEN}" if [ -n "$OP_CONNECT_TOKEN" ]; then echo "OP_CONNECT_TOKEN=$OP_CONNECT_TOKEN" >> $GITHUB_ENV fi diff --git a/entrypoint.sh b/entrypoint.sh index 51089b0..66b4d81 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2046,SC2001,SC2086 set -e managed_by_statement="Managed by 1Password" diff --git a/tests/assert-env-set.sh b/tests/assert-env-set.sh index ece0f8d..1871707 100755 --- a/tests/assert-env-set.sh +++ b/tests/assert-env-set.sh @@ -1,4 +1,7 @@ #!/bin/bash +# shellcheck disable=SC2086 +set -e + assert_env_equals() { if [ "$(printenv $1)" != "$2" ]; then echo -e "Expected $1 to be set to:\n$2\nBut got:\n$(printenv $1)" diff --git a/tests/assert-env-unset.sh b/tests/assert-env-unset.sh index ce630f7..e4c6448 100755 --- a/tests/assert-env-unset.sh +++ b/tests/assert-env-unset.sh @@ -1,4 +1,7 @@ #!/bin/bash +# shellcheck disable=SC2086 +set -e + assert_env_unset() { if [ -n "$(printenv $1)" ]; then echo "Expected secret $1 to be unset"