fix: match 'Last updated' timestamp with or without bold markers (#1836)

The template outputs plain text `Last updated: [DATE]` but both
update-agent-context scripts only matched `**Last updated**: [DATE]`
(bold Markdown). Make the bold markers optional in the regex so the
timestamp is refreshed regardless of formatting.

Co-authored-by: easonysliu <easonysliu@tencent.com>
Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com>
This commit is contained in:
eason
2026-03-14 00:46:21 +08:00
committed by GitHub
parent b9c1a1c7bb
commit c883952b43
2 changed files with 2 additions and 2 deletions

View File

@@ -482,7 +482,7 @@ update_existing_agent_file() {
fi fi
# Update timestamp # Update timestamp
if [[ "$line" =~ \*\*Last\ updated\*\*:.*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then if [[ "$line" =~ (\*\*)?Last\ updated(\*\*)?:.*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then
echo "$line" | sed "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/$current_date/" >> "$temp_file" echo "$line" | sed "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/$current_date/" >> "$temp_file"
else else
echo "$line" >> "$temp_file" echo "$line" >> "$temp_file"

View File

@@ -331,7 +331,7 @@ function Update-ExistingAgentFile {
if ($existingChanges -lt 2) { $output.Add($line); $existingChanges++ } if ($existingChanges -lt 2) { $output.Add($line); $existingChanges++ }
continue continue
} }
if ($line -match '\*\*Last updated\*\*: .*\d{4}-\d{2}-\d{2}') { if ($line -match '(\*\*)?Last updated(\*\*)?: .*\d{4}-\d{2}-\d{2}') {
$output.Add(($line -replace '\d{4}-\d{2}-\d{2}',$Date.ToString('yyyy-MM-dd'))) $output.Add(($line -replace '\d{4}-\d{2}-\d{2}',$Date.ToString('yyyy-MM-dd')))
continue continue
} }