Skip to content

Commit

Permalink
Merge pull request #13 from austinvazquez/add-shellcheck-and-resolve-…
Browse files Browse the repository at this point in the history
…warnings

Add shellcheck to CI and resolve warnings
  • Loading branch information
estesp authored Mar 23, 2024
2 parents bf66c6b + 591ce0d commit 2c201e1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
pull-requests: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install shellcheck
run: |
scversion="v0.10.0"
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
echo "${PWD}/shellcheck-${scversion}/shellcheck" >> ${GITHUB_PATH}
- name: Shellcheck
run: |
shellcheck ./script/validate/dco ./script/validate/fileheader ./script/validate/vendor
4 changes: 2 additions & 2 deletions script/validate/dco
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi
verbosity="${DCO_VERBOSITY--v}"
range=
commit_range="${DCO_RANGE-}"
[ ! -z "${commit_range}" ] && {
[ -n "${commit_range}" ] && {
range="-range ${commit_range}"
}
GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation ${verbosity} ${range} -run DCO,short-subject,dangling-whitespace
GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation "${verbosity}" "${range}" -run DCO,short-subject,dangling-whitespace
4 changes: 2 additions & 2 deletions script/validate/vendor
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ DIFF_PATH="vendor/ go.mod go.sum"
# need word splitting here to avoid reading the whole DIFF_PATH as one pathspec
#
# shellcheck disable=SC2046
DIFF=$(git status --porcelain -- $DIFF_PATH)
DIFF_CONTENT=$(git diff -- $DIFF_PATH)
DIFF=$(git status --porcelain -- "${DIFF_PATH}")
DIFF_CONTENT=$(git diff -- "${DIFF_PATH}")

if [ "$DIFF" ]; then
echo
Expand Down

0 comments on commit 2c201e1

Please sign in to comment.