Files
build/.github/workflows/pr-lint-scripts.yml
dependabot[bot] 9ca5752314 build(deps): bump tj-actions/changed-files
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from f963b3f3562b00b6d2dd25efc390eb04e51ef6c6 to 2036da178f85576f1940fedb74bb93a36cd89ab7.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](f963b3f356...2036da178f)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-version: 2036da178f85576f1940fedb74bb93a36cd89ab7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 17:26:59 +08:00

60 lines
1.7 KiB
YAML

name: Lint on Scripts
run-name: 'Shellcheck - PR #${{ github.event.pull_request.number }} ("${{ github.event.pull_request.title }}")'
#
# Run ShellCheck on all scripts and generate report as build artifact
#
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
concurrency:
group: pipeline-lint-${{github.event.pull_request.number}}
cancel-in-progress: true
jobs:
Shellcheck:
name: Shell script analysis
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@2036da178f85576f1940fedb74bb93a36cd89ab7 # v46.0.3
- name: List all changed files
run: |
# Use framework internal mechanism for checking `lib` and `extensions` code only one file is passed,
# and source's are followed, thus the whole project is "understood" by shellcheck.
# For example, when checking individual files, one variable might be thought "unused" because it
# is only used in another file, which does not happen when done properly.
bash lib/tools/shellcheck.sh
ret=0
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ ! "${file}" =~ lib/|extensions/|.py|.service|.rules|.network|.netdev ]]; then
if grep -qE "^#\!/.*bash" $file; then
shellcheck --severity=error $file || ret=$?
fi
fi
done
exit $ret