chore(code_layout): use env var and pipe to bypass the "Argument list too long" error

This commit is contained in:
bdm-oslandia 2024-03-20 16:06:35 +01:00 committed by Nyall Dawson
parent cd741cf67d
commit 565b0b9002
2 changed files with 24 additions and 13 deletions

View File

@ -154,25 +154,24 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Requirements
run: |
sudo apt install -y \
expect \
silversearcher-ag
- uses: tj-actions/changed-files@v42
- name: Retrieve changed files
uses: tj-actions/changed-files@v43
id: changed_files
with:
separator: ' '
files_ignore: |
**/*.sip.in
**/*.png
**/*.svg
**/*.tif*
**/*.gpkg
**/*.qgz
**/*.qgs
separator: " "
- name: Spell Test
run: ./scripts/spell_check/check_spelling.sh -r "${{ steps.changed_files.outputs.all_changed_files }}"
if: steps.changed_files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
run: echo "$ALL_CHANGED_FILES" | ./scripts/spell_check/check_spelling.sh
sip_check:
runs-on: ubuntu-latest

View File

@ -61,9 +61,21 @@ while getopts ":rdl:" opt; do
done
shift $((OPTIND - 1))
if [ $# -ne 0 ]; then
# check pipe or command line
if [ -p /dev/stdin ]; then
# with pipe input
read SCRIPT_INPUT
if [ -z "$SCRIPT_INPUT" ]; then
exit 0
fi
else
# no pipe input
SCRIPT_INPUT="$@"
fi
if [ -n "$SCRIPT_INPUT" ]; then
EXCLUDE=$(${GP}sed -e 's/\s*#.*$//' -e '/^\s*$/d' $AGIGNORE | tr '\n' '|' | ${GP}sed -e 's/|$//')
INPUTFILES=$(echo "$@" | tr -s '[[:blank:]]' '\n' | ${GP}grep -Eiv "$EXCLUDE" | tr '\n' ' ' )
INPUTFILES=$(echo "$SCRIPT_INPUT" | tr -s '[[:blank:]]' '\n' | ${GP}grep -Eiv "$EXCLUDE" | tr '\n' ' ' )
if [[ -z $INPUTFILES ]]; then
exit 0
fi