Skip to content

chore: Debug

chore: Debug #38

Workflow file for this run

name: PHP Mess Detector
on: push
jobs:
phpmd:
name: PHP Mess Detector
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP environment
uses: shivammathur/setup-php@v2
with:
coverage: none
tools: phpmd
- uses: Ana06/[email protected]
id: files
with:
format: 'csv'
filter: '*.php'
- name: Run PHP Mess Detector on modified files
shell: bash
run: |
FILELIST=$(mktemp /tmp/phpmd-check.XXXXXX)
echo ${{ steps.files.outputs.added_modified }}
mapfile -d ',' -t all_files < <(printf '%s,' '${{ steps.files.outputs.added_modified }}')
for FILE in "${all_files[@]}"; do
EXT="${FILE##*.}"
echo "Changed file: " $FILE ", extension: " $EXT
if [[ "$EXT" == "php" ]]; then
echo "${FILE}" >> "${FILELIST}"
echo "File added to the file list: " $FILE
fi
done
if [ -s "${all_files[@]}" ]; then
FILES=`echo ${{ steps.files.outputs.all }} | paste -sd "," -`
echo "Running PHPMD on" $FILES
phpmd $FILES github .github/phpmd-ruleset.xml --exclude 'vendor/*'
RETVAL=$?
echo "The following files were tested for PSR-12 errors:"; echo
cat -n "$FILELIST"
else
echo "There are no changes in PHP files (no PHP-MD test performed)"
fi
rm "$FILELIST"
exit $RETVAL