24 lines
879 B
YAML
24 lines
879 B
YAML
name: Shell
|
|
|
|
# Relevant to events - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
|
|
on:
|
|
pull_request:
|
|
types: [synchronize, opened, reopened, ready_for_review]
|
|
paths:
|
|
- '**.sh'
|
|
|
|
jobs:
|
|
# Linting
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Installing dependencies..
|
|
run: if ! apt list --installed | grep -qP ".*shellcheck.*"; then apt install -y shellcheck; fi
|
|
- name: Linting..
|
|
# FIXME: False triggers on files which names continues after `.sh` i.e `something.sh.something`
|
|
run: |
|
|
cd "$GITHUB_WORKSPACE" && for file in $(git ls-tree --name-only -r ${{ github.sha }} | grep '\.sh$'); do
|
|
printf 'linting shell file %s' "$file"
|
|
shellcheck --external-sources --shell=sh "$file"
|
|
done |