2024-09-18 19:56:46 +01:00
|
|
|
name: Check for bashisms
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2024-11-01 17:21:49 +00:00
|
|
|
- 'core/tabs/**/*.sh'
|
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
|
|
|
|
2024-11-01 17:21:49 +00:00
|
|
|
- name: Install devscripts
|
|
|
|
run: sudo apt-get update && sudo apt-get install -y devscripts
|
|
|
|
|
|
|
|
- name: Get changed .sh files (PR only)
|
|
|
|
id: changed-sh-files
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
uses: tj-actions/changed-files@v45
|
|
|
|
with:
|
|
|
|
files: '**/*.sh'
|
|
|
|
|
|
|
|
- name: Get all .sh files (if workflow dispatched)
|
|
|
|
id: sh-files
|
|
|
|
if: github.event_name != 'pull_request'
|
2024-09-22 18:37:01 +01:00
|
|
|
run: |
|
2024-11-01 17:21:49 +00:00
|
|
|
files=$(find . -type f -name "*.sh" | tr '\n' ' ')
|
|
|
|
echo "files=${files:-none}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Set FILES for bashism check
|
|
|
|
id: set-files
|
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.changed-sh-files.outputs.any_changed }}" == 'true' ]]; then
|
|
|
|
echo "FILES=${{ steps.changed-sh-files.outputs.all_changed_files }}" >> $GITHUB_ENV
|
2024-10-02 16:43:04 +01:00
|
|
|
else
|
2024-11-01 17:21:49 +00:00
|
|
|
echo "FILES=${{ env.files }}" >> $GITHUB_ENV
|
2024-10-02 16:43:04 +01:00
|
|
|
fi
|
2024-09-18 19:56:46 +01:00
|
|
|
|
2024-09-22 17:04:58 +01:00
|
|
|
- name: Check for bashisms
|
2024-09-19 14:15:49 +01:00
|
|
|
run: |
|
2024-11-01 17:21:49 +00:00
|
|
|
IFS=' ' read -r -a file_array <<< "$FILES"
|
|
|
|
checkbashisms "${file_array[@]}"
|