Add software package: Home Assistant #1149
This file contains 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: Lint scripts | |
on: | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: linter-${{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@v4 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
- name: "Show which files we check" | |
shell: bash {0} | |
run: | | |
echo "# Checked files:" >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.changed-files.outputs.all_changed_files }}" | sed "s/ /\n/g" >> $GITHUB_STEP_SUMMARY | |
- name: Environment variables | |
run: sudo -E bash -c set | |
- name: "Shellcheck lint error report in diff format" | |
shell: bash {0} | |
run: | | |
if [[ -n "${{ steps.changed-files.outputs.all_changed_files }}" ]]; then | |
FILES="${{ steps.changed-files.outputs.all_changed_files }}" | |
for file in $FILES; do | |
if grep -qE "^#\!/.*bash" $file; then | |
shellcheck --severity=error $file || ret=$? | |
fi | |
done | |
else | |
FILES="$(find . -name "*.sh" ! -path '*/.git*/*' -exec grep -Iq . {} \; -print)" | |
for file in $FILES; do | |
if grep -qE "^#\!/.*bash" $file; then | |
shellcheck --severity=error $file || ret=$? | |
fi | |
done | |
fi | |
exit $ret |