Skip to content

Fix shell script hygiene: shebang, pipefail, quoting, SC2155; add ShellCheck CI#5

Merged
eapolinario merged 3 commits intomainfrom
copilot/improve-repo-quality
Mar 10, 2026
Merged

Fix shell script hygiene: shebang, pipefail, quoting, SC2155; add ShellCheck CI#5
eapolinario merged 3 commits intomainfrom
copilot/improve-repo-quality

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

  • Explore repository and identify issues
  • Fix macos/install.sh shebang, pipefail, quoting, ${BASH_SOURCE[0]}
  • Fix omarchy/install.sh SC2155 — separate readonly from assignment
  • Add .github/workflows/shellcheck.yml — CI ShellCheck job
  • Fix CI failure: exclude macos/zsh from ShellCheck scan — .zshrc and .p10k.zsh are Zsh config files that ShellCheck cannot parse

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- macos/install.sh: fix shebang (#!/bin/sh -> #!/usr/bin/env bash),
  add pipefail, quote $CONFIG_HOME vars, use ${BASH_SOURCE[0]}
- omarchy/install.sh: separate readonly SCRIPT_DIR declaration from
  assignment to avoid masking return values (SC2155)
- .github/workflows/shellcheck.yml: new CI job to run ShellCheck on
  push and pull_requests

Co-authored-by: eapolinario <653394+eapolinario@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve overall repository quality and performance Fix shell script hygiene: shebang, pipefail, quoting, SC2155; add ShellCheck CI Mar 9, 2026
@eapolinario
Copy link
Owner

@copilot , what's up with the Shell lint errors in CI?

.zshrc and .p10k.zsh are Zsh config files that ShellCheck can't
parse (SC2148 no-shebang, SC1073/SC1072 parse errors). Use
ignore_paths to skip that directory.

Co-authored-by: eapolinario <653394+eapolinario@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 9, 2026

@copilot , what's up with the Shell lint errors in CI?

The action was scanning macos/zsh/.zshrc and macos/zsh/.p10k.zsh — Zsh config files that ShellCheck can't parse (no shebang → SC2148, zsh-specific syntax → parse errors SC1073/SC1072). Fixed in d3a4cfa by adding ignore_paths: macos/zsh to the workflow so only real shell scripts are checked.

@eapolinario eapolinario marked this pull request as ready for review March 10, 2026 00:35
Copilot AI review requested due to automatic review settings March 10, 2026 00:35
@eapolinario eapolinario merged commit adf694c into main Mar 10, 2026
3 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves shell script hygiene across the repository and introduces a ShellCheck CI workflow to enforce these standards going forward. It fixes several common shell scripting issues flagged by ShellCheck (SC2155, missing pipefail, unquoted variables, wrong shebang) and adds automated linting on every push and PR.

Changes:

  • Fix macos/install.sh: upgrade shebang to #!/usr/bin/env bash, add pipefail, quote all variable expansions, use ${BASH_SOURCE[0]} instead of $0
  • Fix omarchy/install.sh: separate readonly SCRIPT_DIR from the command-substitution assignment to avoid masking the subshell exit code (SC2155)
  • Add .github/workflows/shellcheck.yml: new CI job using ludeeus/action-shellcheck@2.0.0, excluding macos/zsh to avoid Zsh-syntax parse errors

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
macos/install.sh Corrects shebang, adds pipefail, uses ${BASH_SOURCE[0]}, and properly quotes all variable expansions
omarchy/install.sh Splits readonly SCRIPT_DIR from its command-substitution assignment to avoid masking exit codes (SC2155)
.github/workflows/shellcheck.yml New CI workflow that runs ShellCheck on all shell scripts, excluding macos/zsh to skip Zsh-only config files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

with:
check_together: 'yes'
severity: warning
ignore_paths: macos/zsh
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ignore_paths: macos/zsh exclusion is broader than necessary. While it correctly skips .zshrc and .p10k.zsh (Zsh-specific files that ShellCheck cannot parse), it also silently drops macos/zsh/.lessfilter.sh from the ShellCheck scan — a valid #!/usr/bin/env bash script that should be linted.

A more precise approach would be to keep the whole macos/zsh directory in scope and instead add inline # shellcheck shell=bash directives (or # shellcheck disable annotations) to the Zsh config files, or use the ignore_files input to exclude only the specific files (.zshrc, .p10k.zsh). Alternatively, moving .lessfilter.sh out of macos/zsh/ into its own directory would let the exclusion be exact.

Suggested change
ignore_paths: macos/zsh
ignore_files: macos/zsh/.zshrc macos/zsh/.p10k.zsh

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants