Skip to content

Commit 1f2b669

Browse files
authored
Update docs_test.sh
1 parent fbbdb98 commit 1f2b669

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/docs_test.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,17 @@ while IFS= read -r line; do
4242
done <<< "$output"
4343

4444
json_output+="]" # End the JSON array
45-
46-
results="$json_output"
47-
4845
echo "$json_output"
46+
results="$json_output"
4947

5048
# Loop through each job in the JSON output
5149
echo "$results" | jq -c '.[]' | while IFS= read -r item; do
5250
job_status=$(echo "$item" | jq -r '.status')
5351
exit_code=$(echo "$item" | jq -r '.exit_code')
5452
md_path=$(echo "$item" | jq -r '.md_path')
53+
54+
echo "Processing $md_path" # Debug: show which file is being processed
55+
5556
# Determine badge color and label based on status
5657
if [[ "$job_status" == "Completed" ]] && [[ "$exit_code" == "0" ]]; then
5758
badge_color="green"
@@ -66,9 +67,10 @@ echo "$results" | jq -c '.[]' | while IFS= read -r item; do
6667

6768
# Check if the markdown file exists
6869
if [ -f "$md_path" ]; then
70+
echo "Found $md_path" # Debug: confirm the file exists
71+
6972
# Use sed to replace the existing badge URL
70-
# This regex matches the part of the URL up to the "Test-" label, followed by any text up to the last hyphen, which is presumed to be the color
71-
sed -i '' -E "s|(https://img.shields.io/badge/Test-[^-]+-[^-]+)([^)]*\))|$badge_url\2|" "$md_path"
73+
sed -i -E "s|(https://img.shields.io/badge/Test-[^-]+-[^-]+)([^)]*\))|$badge_url\2|" "$md_path"
7274
else
7375
echo "Markdown file does not exist: $md_path"
7476
fi

0 commit comments

Comments
 (0)