Skip to content

Commit 5f33886

Browse files
committed
Improved file counting
1 parent 075cb7b commit 5f33886

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

action.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ runs:
175175
echo "Files key found, proceeding to create files..."
176176
177177
# Get each key from files object and create a file with that name
178-
jq -r '.files | keys[]' "$RESPONSE_FILE" | while read -r filename; do
178+
while IFS= read -r filename; do
179179
echo "Processing file: $filename"
180180
181181
# Get the content for this filename
@@ -208,11 +208,7 @@ runs:
208208
echo "Created documentation file: $output_dir/$output_filename"
209209
MARKDOWN_FILES_CREATED=$((MARKDOWN_FILES_CREATED + 1))
210210
fi
211-
done
212-
213-
# Since we're in a subshell, we need to count files differently
214-
MARKDOWN_FILES_CREATED=$(find "$MD_OUTPUT_DIR" -name "*${OUTPUT_FORMAT}" 2>/dev/null | wc -l || echo "0")
215-
JSON_FILES_CREATED=$(find "$JSON_OUTPUT_DIR" -name "*.json" 2>/dev/null | wc -l || echo "0")
211+
done < <(jq -r '.files | keys[]' "$RESPONSE_FILE")
216212
else
217213
echo "No 'files' key found in response JSON"
218214
fi
@@ -247,4 +243,4 @@ runs:
247243
echo "json_files_created=$JSON_FILES_CREATED" >> $GITHUB_OUTPUT
248244
echo "output_directory=$MD_OUTPUT_DIR" >> $GITHUB_OUTPUT
249245
echo "json_directory=$JSON_OUTPUT_DIR" >> $GITHUB_OUTPUT
250-
echo "has_changes=$HAS_CHANGES" >> $GITHUB_OUTPUT
246+
echo "has_changes=$HAS_CHANGES" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)