Skip to content

Commit

Permalink
[CI] Semconv: apply patch to remove path_base
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jan 30, 2025
1 parent 359e01c commit 1a49996
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/content-modules/adjust-pages.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

my %versFromSubmod = %versions; # Actual version of submodules. Updated by getVersFromSubmodule().

sub printTitleAndFrontMatter() {
sub printFrontMatter() {
print "---\n";
if ($title eq 'OpenTelemetry Specification') {
$title .= " $otelSpecVers";
Expand All @@ -46,7 +46,7 @@ ()
$frontMatterFromFile =~ s/(title|linkTitle): .*/$& $otlpSpecVers/g;
# TODO: add to spec landing page
$frontMatterFromFile .= "weight: 20\n" if $frontMatterFromFile !~ /^\s*weight/;
} elsif ($ARGV =~ /semconv\/docs\/\w+.md$/) {
} elsif ($ARGV =~ /^tmp\/semconv\/docs\/\w+.md$/) {
$title .= " $semconvVers";
$frontMatterFromFile =~ s/linkTitle: .*/$& $semconvVers/;
# $frontMatterFromFile =~ s/body_class: .*/$& td-page--draft/;
Expand All @@ -59,6 +59,15 @@ ()
# applyPatchOrPrintMsgIf('2024-12-01-bridge-api', 'spec', '1.39.0');
# }

if ($ARGV =~ m{^tmp/semconv/docs.*/(README|_index)\.md$}
&& applyPatchOrPrintMsgIf('2025-01-29-path-base', 'semconv', '1.30.0-19-g')
&& $frontMatterFromFile =~ /^path_base_for_github_subdir:/m
) {
$frontMatterFromFile =~ s/\npath_base_for_github_subdir:.*?\n/\n/;
$frontMatterFromFile =~ s|\n from: tmp/semconv/docs/.*?\n|\n|;
$frontMatterFromFile =~ s/\n to: .*README.md($|\n)/$1/;
}

my $titleMaybeQuoted = ($title =~ ':') ? "\"$title\"" : $title;
print "title: $titleMaybeQuoted\n" if $frontMatterFromFile !~ /title: /;
if ($title =~ /^OpenTelemetry (Protocol )?(.*)/) {
Expand Down Expand Up @@ -103,7 +112,7 @@ ()

sub patchSemConv1_30_0() {
return unless $ARGV =~ /^tmp\/semconv\/docs\//
&& applyPatchOrPrintMsgIf('2025-01-24-emit-an-event', 'semconv', '1.30.0-3-g');
&& applyPatchOrPrintMsgIf('2025-01-24-emit-an-event-etc', 'semconv', '1.30.0-18-g');

s|Emit Event API|Log API|;
s|(docs/specs/otel/logs/api.md#emit-a)n-event|$1-logrecord|;
Expand Down Expand Up @@ -162,7 +171,7 @@ ()
if(! $title) {
($title) = /^#\s+(.*)/;
$linkTitle = '';
printTitleAndFrontMatter() if $title;
printFrontMatter() if $title;
next;
}

Expand Down

0 comments on commit 1a49996

Please sign in to comment.