Skip to content

Commit 0d79fe3

Browse files
authored
Add release-notes output (#28)
Closes: #27.
1 parent 77ac767 commit 0d79fe3

File tree

15 files changed

+189
-63
lines changed

15 files changed

+189
-63
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Use LF as default EOL marker
2+
* text=auto eol=lf

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add a new `release-notes` output to the action containing the release notes for the newly released versions.
13+
1014
## [3.0.0] - 2024-04-08
1115

1216
### Fixed

__tests__/fixtures/empty_release/release-notes.expected.md

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Added
2+
3+
- Everything since the beginning!

__tests__/fixtures/lowercase_link_reference/release-notes.expected.md

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Changed
2+
3+
- Our main theme is now blue instead of red.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Changed
2+
3+
- Our main theme is now blue instead of red.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Changed
2+
3+
- Our main theme is now blue instead of red.

__tests__/getReleaseNotes.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import getReleaseNotes from "../src/getReleaseNotes";
2+
import { read } from "to-vfile";
3+
4+
interface Fixture {
5+
tag: string;
6+
version: string;
7+
date: string;
8+
genesisHash: string;
9+
owner: string;
10+
repo: string;
11+
}
12+
13+
it.each(["empty_release", "standard", "first_release", "lowercase_link_reference", "tag_release", "tag_on_tag"])(
14+
`should extract %s release-notes output`,
15+
async function(testcase) {
16+
const expectedChangelog = await read(
17+
`./__tests__/fixtures/${testcase}/CHANGELOG.expected.md`,
18+
{
19+
encoding: "utf-8"
20+
}
21+
);
22+
const release: Fixture = await import(
23+
`./fixtures/${testcase}/fixture`
24+
).then(module => module.default);
25+
26+
const expectedReleaseNotes = await read(
27+
`./__tests__/fixtures/${testcase}/release-notes.expected.md`,
28+
{
29+
encoding: "utf-8"
30+
}
31+
).then(expected => expected.toString("utf-8"));
32+
const actualReleaseNotes = getReleaseNotes(expectedChangelog, release.version);
33+
expect(actualReleaseNotes).toEqual(expectedReleaseNotes);
34+
}
35+
);

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inputs:
1717
changelogPath:
1818
description: 'The path to the changelog file. Defaults to `./CHANGELOG.md`'
1919
required: false
20+
outputs:
21+
release-notes:
22+
description: 'The release notes of the newly released version'
2023
runs:
2124
using: 'node20'
2225
main: 'dist/index.js'

0 commit comments

Comments
 (0)