Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ Currently, there is no automated test suite. Manual testing is performed by:
- Exit with appropriate status codes (0 for success, non-zero for errors)
- Use descriptive echo messages with emojis for user feedback (✅ ❌ ⚠️)

### GitHub Actions Workflows

- Set permissions at the workflow level as the default
- Only override permissions at the job level when specific jobs need different access
- Use latest versions of actions (e.g., `actions/checkout@v6`)
- Use `ubuntu-slim` runner for lightweight, fast-running tasks (linting, formatting, etc.)
- Use `ubuntu-latest` for resource-intensive or long-running tasks
- Always set explicit permissions following the principle of least privilege
- Use custom code over third-party actions when simple and maintainable

## Known Limitations

- No automated testing infrastructure
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/shellcheck.yml
Comment thread
mikeharder marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Shellcheck

on:
pull_request:
paths:
- '**.sh'

permissions:
contents: read

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-slim

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Run shellcheck on changed files
run: |
# Get the base branch
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.sha }}"

echo "Comparing $BASE_SHA...$HEAD_SHA"
echo ""

# Get changed shell scripts
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT "$BASE_SHA...$HEAD_SHA" | grep '\.sh$' || true)

if [ -z "$CHANGED_FILES" ]; then
echo "No shell scripts changed in this PR"
exit 0
fi

echo "Changed shell scripts:"
echo "$CHANGED_FILES"
echo ""

# Run shellcheck on each changed file
exit_code=0
while IFS= read -r file; do
if [ -n "$file" ]; then
echo "Checking $file..."
if ! shellcheck "$file"; then
exit_code=1
fi
fi
done <<< "$CHANGED_FILES"

exit "$exit_code"