Skip to content

Commit d0309ea

Browse files
authored
Merge pull request #34 from TongWu/dev
Fix weekly release asset filenames
2 parents 9bcfbee + 73a5c52 commit d0309ea

12 files changed

+61037
-22
lines changed

.github/workflows/GenerateReport.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -415,32 +415,43 @@ jobs:
415415
id: find_latest
416416
run: |
417417
echo "📁 Scanning for latest report set..."
418-
latest_json=$(find WeeklyReport -type f -name "WeeklyReport_*.json" | \
419-
sed -E 's/\.json$//' | \
420-
sort -t '_' -k2 | \
421-
tail -n 1).json
422418
423-
if [[ -z "$latest_json" || ! -f "$latest_json" ]]; then
424-
echo "❌ No valid JSON report found."
419+
latest_csv=$(find WeeklyReport -type f -name "WeeklyReport_*.csv" | sort | tail -n 1)
420+
421+
if [[ -z "$latest_csv" || ! -f "$latest_csv" ]]; then
422+
echo "❌ No weekly CSV report found."
425423
exit 1
426424
fi
427425
428-
base_name="${latest_json%.json}"
429-
csv_file="${base_name}.csv"
426+
base_name="${latest_csv%.csv}"
430427
html_file="${base_name}.html"
428+
json_file="${base_name}.json"
431429
432430
echo "📝 Latest base: $base_name"
433-
echo "📄 CSV: $csv_file"
431+
echo "📄 CSV: $latest_csv"
434432
echo "📄 HTML: $html_file"
435-
echo "📄 JSON: $latest_json"
433+
echo "📄 JSON: $json_file"
436434
437-
echo "CSV_PATH=$csv_file" >> $GITHUB_ENV
438-
echo "HTML_PATH=$html_file" >> $GITHUB_ENV
439-
echo "JSON_PATH=$latest_json" >> $GITHUB_ENV
435+
echo "CSV_PATH=$latest_csv" >> $GITHUB_ENV
436+
echo "CSV_FILENAME=$(basename \"$latest_csv\")" >> $GITHUB_ENV
440437
441-
echo "CSV_FILENAME=$(basename "$csv_file")" >> $GITHUB_ENV
442-
echo "HTML_FILENAME=$(basename "$html_file")" >> $GITHUB_ENV
443-
echo "JSON_FILENAME=$(basename "$latest_json")" >> $GITHUB_ENV
438+
if [[ -f "$html_file" ]]; then
439+
echo "HTML_PATH=$html_file" >> $GITHUB_ENV
440+
echo "HTML_FILENAME=$(basename \"$html_file\")" >> $GITHUB_ENV
441+
else
442+
echo "⚠️ HTML report not found: $html_file"
443+
echo "HTML_PATH=" >> $GITHUB_ENV
444+
echo "HTML_FILENAME=" >> $GITHUB_ENV
445+
fi
446+
447+
if [[ -f "$json_file" ]]; then
448+
echo "JSON_PATH=$json_file" >> $GITHUB_ENV
449+
echo "JSON_FILENAME=$(basename \"$json_file\")" >> $GITHUB_ENV
450+
else
451+
echo "⚠️ JSON report not found: $json_file"
452+
echo "JSON_PATH=" >> $GITHUB_ENV
453+
echo "JSON_FILENAME=" >> $GITHUB_ENV
454+
fi
444455
445456
# 🗓️ Get the Monday of current week
446457
MONDAY_DATE=$(date -d "$(date +%Y-%m-%d -d @$(( $(date +%s) - ($(date +%u) - 1) * 86400 )))" +%Y-%m-%d)
@@ -474,10 +485,16 @@ jobs:
474485
run: |
475486
gh release create "$RELEASE_TAG" \
476487
"$CSV_PATH#${CSV_FILENAME}" \
477-
"$HTML_PATH#${HTML_FILENAME}" \
478-
"$JSON_PATH#${JSON_FILENAME}" \
479488
--title "Weekly Report - $MONDAY_DATE_DISPLAY (Generated at $GENERATED_DATE)" \
480489
--notes "Automated weekly report"
490+
491+
if [[ -n "$HTML_PATH" ]]; then
492+
gh release upload "$RELEASE_TAG" "$HTML_PATH#${HTML_FILENAME}" --clobber
493+
fi
494+
495+
if [[ -n "$JSON_PATH" ]]; then
496+
gh release upload "$RELEASE_TAG" "$JSON_PATH#${JSON_FILENAME}" --clobber
497+
fi
481498
env:
482499
GH_TOKEN: ${{ secrets.GH_PAT }}
483500

103 KB
Binary file not shown.
106 KB
Binary file not shown.
106 KB
Binary file not shown.
106 KB
Binary file not shown.

WeeklyReport/2025-06-30/WeeklyReport_20250705_124618.csv

Lines changed: 902 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)