From 6ee2a845159e7ad91305dd72a034226766038f08 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Sep 2025 09:28:48 -0400 Subject: [PATCH 1/3] Add github action to shellcheck release on push and PRs --- .github/workflows/shellcheck.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 000000000..a15b1bf7a --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,26 @@ +--- +name: Shellcheck + +on: + push: + branches: [release] + pull_request: + branches: [release] + +permissions: + contents: read + +jobs: + shellcheck: + name: Check shell scripts + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt update && sudo apt install -y shellcheck + - name: shellcheck + run: | + git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck From 1058c14f2393f4b374a08168202bd827b567c77c Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Sep 2025 09:28:54 -0400 Subject: [PATCH 2/3] [DATALAD RUNCMD] Autopatch using shellcheck (will need fixups) === Do not change lines below === { "chain": [], "cmd": "shellcheckit autopatch", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- gather-system-info.sh | 2 +- shell.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gather-system-info.sh b/gather-system-info.sh index 34c9ee301..72f984b1f 100755 --- a/gather-system-info.sh +++ b/gather-system-info.sh @@ -11,7 +11,7 @@ REPO="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" main() { - cd "${REPO}" + cd "${REPO}" || exit echo "Please include this information in your bug report on GitHub!" diff --git a/shell.sh b/shell.sh index db1a3946f..b60328d3b 100755 --- a/shell.sh +++ b/shell.sh @@ -20,9 +20,9 @@ args=() DISPLAY=$NEW_DISPLAY eval $(dbus-launch --exit-with-session --sh-syntax) -echo $DBUS_SESSION_BUS_ADDRESS +echo "$DBUS_SESSION_BUS_ADDRESS" -echo -n $DBUS_SESSION_BUS_ADDRESS \ +echo -n "$DBUS_SESSION_BUS_ADDRESS" \ | DISPLAY=$old_display xclip -i -selection clipboard DISPLAY=$old_display @@ -43,5 +43,5 @@ esac dconf reset -f / # Reset settings dconf write /org/gnome/shell/enabled-extensions "['paperwm@paperwm.github.com']" -gnome-shell $args +gnome-shell "$args" From bf8649e3fe7bd8bfa71b0688eba940ee20a81cd8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 22 Sep 2025 10:32:14 -0400 Subject: [PATCH 3/3] Fix shellcheck warnings - Add shellcheck disable for SC1091 in gather-system-info.sh (sourcing /etc/os-release) - Fix SC2046 in shell.sh: Quote dbus-launch command substitution - Fix SC2178/SC2128 in shell.sh: Use array syntax consistently for args variable All shellcheck warnings resolved. --- gather-system-info.sh | 1 + shell.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gather-system-info.sh b/gather-system-info.sh index 72f984b1f..f088a3b7b 100755 --- a/gather-system-info.sh +++ b/gather-system-info.sh @@ -25,6 +25,7 @@ main() { show_distribution() { echo -n "Distribution: " if [ -f /etc/os-release ]; then + # shellcheck disable=SC1091 source /etc/os-release && echo "${NAME}" fi } diff --git a/shell.sh b/shell.sh index b60328d3b..e25500004 100755 --- a/shell.sh +++ b/shell.sh @@ -19,7 +19,7 @@ export XDG_CONFIG_HOME=$HOME/paperwm/.config args=() DISPLAY=$NEW_DISPLAY -eval $(dbus-launch --exit-with-session --sh-syntax) +eval "$(dbus-launch --exit-with-session --sh-syntax)" echo "$DBUS_SESSION_BUS_ADDRESS" echo -n "$DBUS_SESSION_BUS_ADDRESS" \ @@ -35,7 +35,7 @@ case $1 in echo "Running X11 Gnome Shell" Xephyr $NEW_DISPLAY & DISPLAY=$NEW_DISPLAY - args=--x11 + args=(--x11) ;; esac @@ -43,5 +43,5 @@ esac dconf reset -f / # Reset settings dconf write /org/gnome/shell/enabled-extensions "['paperwm@paperwm.github.com']" -gnome-shell "$args" +gnome-shell "${args[@]}"