Skip to content

Commit 5424030

Browse files
committed
2880: static fixes 4
1 parent e9fe89c commit 5424030

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

.github/workflows/gradle.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,34 @@ jobs:
121121
echo "Modified files: $MODIFIED_FILES"
122122
echo "Added files: $ADDED_FILES"
123123
124-
# Combine and filter for .java files
125-
# Make sure we handle empty arrays properly
126-
if [ "$MODIFIED_FILES" == "[]" ]; then
127-
MODIFIED_FILES="[]"
128-
fi
129-
if [ "$ADDED_FILES" == "[]" ]; then
130-
ADDED_FILES="[]"
124+
# Simple approach using shell commands to filter Java files
125+
# Remove brackets and quotes from the JSON arrays
126+
MODIFIED_FILES=$(echo "$MODIFIED_FILES" | sed 's/^\[//;s/\]$//;s/"//g;s/,/ /g')
127+
ADDED_FILES=$(echo "$ADDED_FILES" | sed 's/^\[//;s/\]$//;s/"//g;s/,/ /g')
128+
129+
# Combine the files and filter for .java files
130+
ALL_FILES="$MODIFIED_FILES $ADDED_FILES"
131+
JAVA_FILES=""
132+
133+
# If there are files to process
134+
if [ ! -z "$ALL_FILES" ]; then
135+
# Filter for Java files and format as JSON array
136+
for file in $ALL_FILES; do
137+
if [[ "$file" == *.java ]]; then
138+
if [ -z "$JAVA_FILES" ]; then
139+
JAVA_FILES="\"$file\""
140+
else
141+
JAVA_FILES="$JAVA_FILES,\"$file\""
142+
fi
143+
fi
144+
done
131145
fi
132146
133-
# Combine arrays and filter for .java files
134-
# Use a more robust approach that doesn't rely on --argjson
135-
COMBINED_FILES=$(echo '{"files":'"$MODIFIED_FILES"', "added":'"$ADDED_FILES"'}' | jq '.files + .added | map(select(endswith(".java")))')
136-
echo "JAVA_FILES=$COMBINED_FILES" >> $GITHUB_ENV
137-
echo "Filtered Java Files: $COMBINED_FILES"
147+
# Create a proper JSON array
148+
JAVA_FILES="[$JAVA_FILES]"
149+
150+
echo "JAVA_FILES=$JAVA_FILES" >> $GITHUB_ENV
151+
echo "Filtered Java Files: $JAVA_FILES"
138152
- name: Run Code Style Check
139153
run: ./gradlew checkstyleCI --no-daemon
140154
env:

0 commit comments

Comments
 (0)