Rename all workflow files to follow a consistent action-oriented naming pattern similar to armbian.github.io: - adjust-maintainers.yml → sync-maintainers-status.yml - clean-workflow-logs.yml → cleanup-workflow-logs.yml - forked-helper.yml → help-forked.yml - issue-welcome-first-time.yml → welcome-issue-first-time.yml - labels-from-yml.yml → sync-labels.yml - merge-announce.yml → announce-merge.yml - open-jira-ticket.yml → create-jira-ticket.yml - pr-announce.yml → announce-pr.yml - pr-auto-labeler.yml → auto-label-pr.yml - pr-build-artifacts.yml → build-pr-artifacts.yml - pr-check-pictures.yml → check-pr-pictures.yml - pr-kernel-security-analysis.yml → analyze-pr-kernel-security.yml - pr-label-on-approved.yml → label-pr-on-approval.yml - pr-lint-scripts.yml → lint-pr-scripts.yml - pr-review-listener.yml → listen-pr-review.yml - pr-welcome-first-time.yml → welcome-pr-first-time.yml - rewrite-kernel-configs.yml → rewrite-kernel-config-files.yml - update-board-list.yml → sync-board-list.yml - update-tools.yml → sync-tools.yml This makes the workflow names more descriptive and consistent with the action verb first, followed by the target object.
60 lines
1.7 KiB
YAML
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@v6
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # 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
|