Skip to content

Commit

Permalink
simplify table replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikel Broström committed Sep 19, 2024
1 parent 3516122 commit 2c42d35
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,12 @@ jobs:
start_marker="<!-- START TRACKER TABLE -->"
end_marker="<!-- END TRACKER TABLE -->"
# Use awk to replace lines between markers, preserving non-table content
# Use awk to replace lines between markers, preserving non-table content
awk -v start_marker="$start_marker" -v end_marker="$end_marker" -v new_table="$new_table" '
BEGIN { in_table=0 }
{
if ($0 == start_marker) {
print $0 # Print the start marker
print new_table # Insert the new table
in_table=1 # Start skipping lines in the old table
next
}
else if ($0 == end_marker) {
in_table=0 # End skipping when reaching end_marker
print $0 # Print end marker
next
}
if (!in_table) {
print $0 # Continue printing lines outside the table
}
}
$0 == start_marker { print $0; print new_table; in_table=1; next }
$0 == end_marker { in_table=0; print $0; next }
!in_table
' "$README_FILE" > temp_readme.md
# Replace original README with updated version
Expand Down

0 comments on commit 2c42d35

Please sign in to comment.