Skip to content

DietPi-Software | frp #6646

DietPi-Software | frp

DietPi-Software | frp #6646

Workflow file for this run

name: shellcheck
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
shellcheck:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
# https://github.com/actions/runner-images
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup DietPi-Globals
run: |
sudo mkdir -p /boot/dietpi/func
sudo cp dietpi/func/dietpi-globals /boot/dietpi/func/
sudo ./dietpi/func/dietpi-obtain_hw_model
echo -e 'G_HW_MEMORY_SIZE=1024\nG_HW_ONBOARD_WIFI=1' | sudo tee -a /boot/dietpi/.hw_model
- name: Download shellcheck
run: |
curl -sSfLo shellcheck.tar.xz "$(curl -sSfH 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' 'https://api.github.com/repos/koalaman/shellcheck/releases/latest' | mawk -F\" '/"browser_download_url.*\.linux\.x86_64\.tar\.xz"/{print $4;exit}')"
tar --wildcards --strip-components=1 -xf shellcheck.tar.xz '*/shellcheck'
rm shellcheck.tar.xz
- name: Run shellcheck
run: |
mapfile -t FILES < <(find . -not \( -path './.git' -prune \) -type f) # read all files to array
for i in "${!FILES[@]}"
do
[[ ${FILES[$i]##*/} =~ '.'[^.]*'sh'$ ]] && continue # file has shell extension
[[ $(mawk '/^#!.*sh([[:blank:]]|$)/;{exit}' "${FILES[$i]}") ]] && continue # file has shell shebang
unset -v "FILES[$i]" # else remove from array
done
./shellcheck -C -xo all "${FILES[@]}"
rm shellcheck
- name: Check for trailing spaces
if: always()
run: |
! grep -rn --exclude-dir='.git' -I '[[:blank:]]$' .
- name: Check for multiple newlines
if: always()
run: |
! grep -rzPo --exclude-dir='.git' --exclude='*.png' '(^|\n)\N*\n\n\n+\N*(\n|$)' .