I am using Github Action to run pylint, I have a list of modified files and need to check if they are blank or not, if they are blank then skip them, how do I do this?
Part of Action:
- name: Get modified files
id: files
uses: umani/changed-files@v3.3.0
with:
repo-token: ${{ github.token }}
pattern: '^src.*\.(py)$'
result-encoding: 'string'
- name: Check files size
id: file_check
run: |
echo "file_size="$(printf "%s" "${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }}" | wc -m) >> $GITHUB_ENV
echo 'MESSAGE=No valid file found, skipped' >> $GITHUB_ENV
- name: Lint with pylint
if: env.file_size > 1
working-directory: ./
run: |
pip install pylint
OUTPUT=$(pylint ${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }} --exit-zero --jobs=0 --rcfile=.pylintrc)
LAST_LINE=$(tail -1 <<< "$OUTPUT")
SCORE=$(sed -n '$s/[^0-9-]*\([-0-9.]*\).*/\1/p' <<< "$OUTPUT")
OUTPUT=$(echo "$OUTPUT" | sed -e '20{$!N;s/\n.*/\n\n\n... results too long, run pylint locally to get full result/' -e 'q}')
OUTPUT+=". Pylint finished with score: $SCORE"
echo "SCORE=$SCORE" >> $GITHUB_ENV
echo 'MESSAGE<<EOF' >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
So what I need to do is loop the variables ${{ steps.files.outputs.files_updated }} ${{ steps.files.outputs.files_created }}"
which are currently encoded as comma separated strings. And check if that file is blank or not, then create a new list with non-blank files, how do I do this?