2024-09-18 19:56:46 +01:00
|
|
|
name: Check for bashisms
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2024-09-20 01:09:53 +01:00
|
|
|
- core/tabs/**
|
2024-09-18 19:56:46 +01:00
|
|
|
merge_group:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-bashisms:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2024-09-19 14:15:49 +01:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- run: git fetch origin ${{ github.base_ref }}
|
2024-09-22 17:04:58 +01:00
|
|
|
|
|
|
|
- name: Get a list of changed script files
|
2024-09-22 18:37:01 +01:00
|
|
|
id: get_sh_files
|
|
|
|
run: |
|
2024-09-22 17:04:58 +01:00
|
|
|
sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true)
|
2024-10-02 16:43:04 +01:00
|
|
|
if [ -n "$sh_files" ]; then
|
|
|
|
echo "$sh_files" > changed_files
|
|
|
|
echo "changed=1" >> $GITHUB_OUTPUT
|
|
|
|
else
|
|
|
|
echo "changed=0" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
2024-09-18 19:56:46 +01:00
|
|
|
|
|
|
|
- name: Install devscripts
|
2024-10-02 16:43:04 +01:00
|
|
|
if: steps.get_sh_files.outputs.changed == 1
|
2024-09-19 01:18:22 +01:00
|
|
|
run: sudo apt-get update && sudo apt-get install devscripts
|
2024-09-18 19:56:46 +01:00
|
|
|
|
2024-09-22 17:04:58 +01:00
|
|
|
- name: Check for bashisms
|
2024-10-02 16:43:04 +01:00
|
|
|
if: steps.get_sh_files.outputs.changed == 1
|
2024-09-19 14:15:49 +01:00
|
|
|
run: |
|
2024-10-02 16:43:04 +01:00
|
|
|
echo "Running for:\n$(cat changed_files)\n"
|
|
|
|
for file in $(cat changed_files); do
|
|
|
|
if [[ -f "$file" ]]; then
|
|
|
|
checkbashisms "$file"
|
|
|
|
fi
|
2024-09-19 14:15:49 +01:00
|
|
|
done
|
2024-10-02 16:43:04 +01:00
|
|
|
|
|
|
|
- name: Remove the created file
|
|
|
|
if: steps.get_sh_files.outputs.changed == 1
|
|
|
|
run: rm changed_files
|