mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-03 14:38:47 +00:00
feat: Include new contributors in the changelog (#49)
* feat: Add mention-new-contributors input * deps: Add marked version 4.0.14 * feat: Include new contributors in the changelog * revert: Test workflow changes
This commit is contained in:
1 parent
49a93eccf5
commit
a3982c4b9b
11 files changed
+130
-4
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { info, setFailed, setOutput } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import { marked } from "marked";
|
||||
import SemVer from "semver";
|
||||
import { getTagSha } from "./tag.js";
|
||||
import { generate } from "./changelog.js";
|
||||
@@ -48,6 +49,26 @@ async function run() {
|
||||
inputs,
|
||||
});
|
||||
|
||||
if (inputs.mentionNewContributors) {
|
||||
const { data } = await octokit.rest.repos.generateReleaseNotes({
|
||||
owner,
|
||||
repo,
|
||||
tag_name: inputs.releaseName,
|
||||
previous_tag_name: tagName,
|
||||
});
|
||||
|
||||
const tokens = marked.lexer(data.body);
|
||||
|
||||
const index = tokens.findIndex(
|
||||
(token) => token.type === "heading" && token.text === "New Contributors",
|
||||
);
|
||||
|
||||
const token = tokens[index + 1];
|
||||
|
||||
if (token.type === "list")
|
||||
changelog += `\n\n## New Contributors\n${token.raw}\n`;
|
||||
}
|
||||
|
||||
if (inputs.includeCompare && tagName != null) {
|
||||
changelog += `\n\n**Full Changelog**: https://github.com/${owner}/${repo}/compare/${tagName}...${inputs.releaseName}`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user