Add root check #683
Workflow file for this run
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: Check for bashisms | |
on: | |
pull_request: | |
paths: | |
- core/tabs/** | |
merge_group: | |
workflow_dispatch: | |
jobs: | |
check-bashisms: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch origin ${{ github.base_ref }} | |
- name: Get a list of changed script files | |
id: get_sh_files | |
run: | | |
sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true) | |
if [ -n "$sh_files" ]; then | |
echo "$sh_files" > changed_files | |
echo "changed=1" >> $GITHUB_OUTPUT | |
else | |
echo "changed=0" >> $GITHUB_OUTPUT | |
fi | |
- name: Install devscripts | |
if: steps.get_sh_files.outputs.changed == 1 | |
run: sudo apt-get update && sudo apt-get install devscripts | |
- name: Check for bashisms | |
if: steps.get_sh_files.outputs.changed == 1 | |
run: | | |
echo "Running for:\n$(cat changed_files)\n" | |
for file in $(cat changed_files); do | |
if [[ -f "$file" ]]; then | |
checkbashisms "$file" | |
fi | |
done | |
- name: Remove the created file | |
if: steps.get_sh_files.outputs.changed == 1 | |
run: rm changed_files |