Refactored shmbridge test #777
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Shell Lint | |
on: | |
pull_request: | |
branches: [ "main" ] | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Install ShellCheck from apt | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y shellcheck=0.9.0-1 | |
- name: Run ShellCheck on changed .sh files in PR | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "Checking only changed shell files in PR..." | |
git fetch origin ${{ github.base_ref }} | |
FILES=$(git diff --diff-filter=d --name-only origin/${{ github.base_ref }} -- '*.sh') | |
if [ -n "$FILES" ]; then | |
echo "$FILES" | tr '\n' '\0' | xargs -0 -r shellcheck -S warning -e SC1091,SC2230,SC3043 | |
else | |
echo "No shell files to lint." | |
fi | |
- name: Run ShellCheck on all .sh files (main or manual trigger) | |
if: github.event_name != 'pull_request' | |
run: | | |
echo "Linting all shell files in repository..." | |
find . -type f -name '*.sh' -print0 | xargs -0 -r shellcheck -S warning -e SC1091,SC2230,SC3043 |