@@ -55,21 +55,32 @@ jobs:
5555 else
5656 CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR HEAD^..HEAD | grep '\.sol$' || true)
5757 fi
58- echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT
59- echo "Changed Solidity files: $CHANGED_FILES"
58+
59+ # Store files in a way that GitHub Actions can handle properly
60+ if [ -n "$CHANGED_FILES" ]; then
61+ echo "has_files=true" >> $GITHUB_OUTPUT
62+ # Save files to a temporary file for the next step
63+ echo "$CHANGED_FILES" > /tmp/changed_files.txt
64+ echo "Changed Solidity files:"
65+ echo "$CHANGED_FILES"
66+ else
67+ echo "has_files=false" >> $GITHUB_OUTPUT
68+ echo "No Solidity files changed"
69+ fi
6070
6171 - name : Check formatting on changed files
62- if : steps.changed-files.outputs.files != ' '
72+ if : steps.changed-files.outputs.has_files == 'true '
6373 run : |
64- # Convert the file list to an array and pass each file individually
65- FILES="${{ steps.changed-files.outputs.files }}"
66- if [ -n "$FILES" ]; then
67- echo "Checking formatting for files: $FILES"
68- echo "$FILES" | while IFS= read -r file; do
74+ # Read files from the temporary file created in the previous step
75+ if [ -f /tmp/changed_files.txt ]; then
76+ echo "Checking formatting for changed Solidity files..."
77+ while IFS= read -r file; do
6978 if [ -n "$file" ]; then
7079 echo "Checking: $file"
7180 forge fmt --check "$file"
7281 fi
73- done
82+ done < /tmp/changed_files.txt
83+ else
84+ echo "No changed files found"
7485 fi
7586 id : fmt
0 commit comments