Skip to content

Commit adf694c

Browse files
authored
Merge pull request #5 from eapolinario/copilot/improve-repo-quality
Fix shell script hygiene: shebang, pipefail, quoting, SC2155; add ShellCheck CI
2 parents 6cb2a14 + d3a4cfa commit adf694c

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

.github/workflows/shellcheck.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Shell Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
shellcheck:
11+
name: ShellCheck
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v4
18+
- name: Run ShellCheck
19+
uses: ludeeus/action-shellcheck@2.0.0
20+
with:
21+
check_together: 'yes'
22+
severity: warning
23+
ignore_paths: macos/zsh

macos/install.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

3-
set -eux # defensive bash programming.
3+
set -euo pipefail
44

5-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66

77
# Only run this script if both gpg *and* the private key are available
88
if ! command -v gpg >/dev/null 2>&1; then
@@ -17,7 +17,7 @@ if ! gpg --list-keys 5C9B334784343A49 >/dev/null 2>&1; then
1717
fi
1818

1919
CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
20-
echo $CONFIG_HOME
20+
echo "$CONFIG_HOME"
2121

2222
################
2323
# stow'd files #
@@ -27,16 +27,16 @@ echo $CONFIG_HOME
2727
stow -d "$SCRIPT_DIR" -vt ~ zsh
2828
stow -d "$SCRIPT_DIR/../common" -vt ~ authinfo
2929

30-
mkdir -p ${CONFIG_HOME}/doom
31-
stow -d "$SCRIPT_DIR/../common" -vt ${CONFIG_HOME}/doom doom
30+
mkdir -p "${CONFIG_HOME}/doom"
31+
stow -d "$SCRIPT_DIR/../common" -vt "${CONFIG_HOME}/doom" doom
3232

3333
for component in \
3434
pip \
3535
skhd \
3636
tmux \
3737
yabai; do
38-
mkdir -p ${CONFIG_HOME}/${component}
39-
stow -d "$SCRIPT_DIR" -vt ${CONFIG_HOME}/${component} ${component}
38+
mkdir -p "${CONFIG_HOME}/${component}"
39+
stow -d "$SCRIPT_DIR" -vt "${CONFIG_HOME}/${component}" "${component}"
4040
done
4141

4242
#######################

omarchy/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set -euo pipefail
44

5-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
readonly SCRIPT_DIR
67

78
DRY_RUN=false
89
declare -a STOW_FLAGS=()

0 commit comments

Comments
 (0)