4848 set -e
4949 SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")
5050 COMMIT_TIME=$(git show -s --format=%cI "$GITHUB_SHA" || date -u +%Y-%m-%dT%H:%M:%SZ)
51- COMMIT_MSG=$(git show -s --format=%s "$GITHUB_SHA" || echo "")
52- # Truncate commit message for display (80 chars max)
53- COMMIT_MSG_SHORT=$(printf '%s' "$COMMIT_MSG" | head -c 80)
54- if [ ${#COMMIT_MSG} -gt 80 ]; then COMMIT_MSG_SHORT="$COMMIT_MSG_SHORT…"; fi
5551 OUTDIR="site"
5652 mkdir -p "$OUTDIR"
5753 # Bring over existing reports so we can publish with keep_files=false safely
7672 if [ -f codestate_pr_report.json ]; then
7773 cp codestate_pr_report.json "$OUTDIR/$SUBPATH/codestate_pr_report.json"
7874 fi
79- # Write metadata for this run
80- COMMIT_MSG_ESC=$(printf '%s' "$COMMIT_MSG" | sed 's/"/\\"/g')
81- printf '%s' "{\"pr_number\":\"$PR_NUMBER\",\"short_sha\":\"$SHORT_SHA\",\"sha\":\"$GITHUB_SHA\",\"time\":\"$COMMIT_TIME\",\"message\":\"$COMMIT_MSG_ESC\"}" > "$OUTDIR/$SUBPATH/metadata.json"
75+ # Write metadata for this run (no commit message)
76+ printf '%s' "{\"pr_number\":\"$PR_NUMBER\",\"short_sha\":\"$SHORT_SHA\",\"sha\":\"$GITHUB_SHA\",\"time\":\"$COMMIT_TIME\"}" > "$OUTDIR/$SUBPATH/metadata.json"
8277 # Build history list from existing content in OUTDIR (copied + current)
8378 HISTORY_FILE_MD="$OUTDIR/history.md"
8479 echo "# CodeState Report History" > "$HISTORY_FILE_MD"
@@ -100,29 +95,23 @@ jobs:
10095 else
10196 label="Manual ($base)"
10297 fi
103- # Try to read metadata for time and full sha
104- TIME=""; FULL_SHA=""; MSG ="";
98+ # Try to read metadata for time and full sha
99+ TIME=""; FULL_SHA="";
105100 if [ -f "$OUTDIR/$dir/metadata.json" ]; then
106101 TIME=$(sed -n 's/.*"time"[[:space:]]*:[[:space:]]*"\(.*\)".*/\1/p' "$OUTDIR/$dir/metadata.json" | head -n1)
107102 FULL_SHA=$(sed -n 's/.*"sha"[[:space:]]*:[[:space:]]*"\(.*\)".*/\1/p' "$OUTDIR/$dir/metadata.json" | head -n1)
108- MSG=$(sed -n 's/.*"message"[[:space:]]*:[[:space:]]*"\(.*\)".*/\1/p' "$OUTDIR/$dir/metadata.json" | head -n1)
109103 fi
110104 short=${base#sha-}
111105 cmd="git checkout ${FULL_SHA:-$short}"
112- # Truncate message for display
113- MSG_SHORT=$(printf '%s' "$MSG" | head -c 80)
114- if [ ${#MSG} -gt 80 ]; then MSG_SHORT="$MSG_SHORT…"; fi
115- if [ -n "$TIME" ] && [ -n "$MSG_SHORT" ]; then
116- echo "- [$label]($dir/) — $TIME — \`$cmd\` — $MSG_SHORT" >> "$HISTORY_FILE_MD"
117- elif [ -n "$TIME" ]; then
106+ if [ -n "$TIME" ]; then
118107 echo "- [$label]($dir/) — $TIME — \`$cmd\`" >> "$HISTORY_FILE_MD"
119108 else
120109 echo "- [$label]($dir/) — \`$cmd\`" >> "$HISTORY_FILE_MD"
121110 fi
122111 done <<< "$EXISTING_INDEXES"
123112 fi
124113 # Add current run at the top
125- echo "- [Current Run]($SUBPATH/) — $COMMIT_TIME — \`git checkout $GITHUB_SHA\` — $COMMIT_MSG_SHORT " | cat - "$HISTORY_FILE_MD" > "$HISTORY_FILE_MD.tmp" && mv "$HISTORY_FILE_MD.tmp" "$HISTORY_FILE_MD"
114+ echo "- [Current Run]($SUBPATH/) — $COMMIT_TIME — \`git checkout $GITHUB_SHA\`" | cat - "$HISTORY_FILE_MD" > "$HISTORY_FILE_MD.tmp" && mv "$HISTORY_FILE_MD.tmp" "$HISTORY_FILE_MD"
126115
127116 # Build index.md from root README plus quick links
128117 INDEX_MD="$OUTDIR/index.md"
0 commit comments