Skip to content

Commit

Permalink
Generate diff link for first release
Browse files Browse the repository at this point in the history
And include the "v" for the version tag in the diff.
  • Loading branch information
theory committed Aug 7, 2024
1 parent be3c8c7 commit 5c3bbb4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .ci/mknotes
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,23 @@ sub run {
$in_item = $self->print_line($out, $line, $in_item)
unless $line =~ $link_regex;
}
# Reach the end of the file; must be the first release. Diff the
# initial commit.
return $self->finish_list($out, $self->initial_commit);
}
}

# All done!
die "Version $self->{version} not found in $self->{file}\n" unless $found;
}

# Called when no previous releases found. Return the initial commit in
# brackets to be parsed by finish_list().
sub initial_commit {
my $sha = qx(git rev-list --max-parents=0 HEAD);
return "[" . substr($sha, 0, 7) . "]";
}

# Called when the next version header is found in line.
sub finish_list {
my ($self, $out, $line) = @_;
Expand All @@ -92,7 +102,7 @@ sub finish_list {

# Emit a footer line with a link to the diff for this version.
print {$out} sprintf(
"---\n\n🆚 For more detail compare [changes since %s](%s/compare/%s...%s).\n",
"---\n\n🆚 For more detail compare [changes since %s](%s/compare/%s...v%s).\n",
$prev, $self->{repo}, $prev, $self->{version},
);

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The theme of this release is *learning Rust and pgrx.*
* Performance [benchmark script]
* Multi-schema [composition example]

[v0.1.0]: https://github.com/tembo-io/pg-jsonschema-boon/compare/34d5d49...HEAD
[v0.1.0]: https://github.com/tembo-io/pg-jsonschema-boon/compare/34d5d49...v0.1.0
[boon]: https://github.com/santhosh-tekuri/boon
[README]: https://github.com/tembo-io/pg-jsonschema-boon/blob/v0.1.0/README.md
[PGXN]: https://pgxn.org/dist/jsonschema/
Expand Down

0 comments on commit 5c3bbb4

Please sign in to comment.