mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-03 06:28:52 +00:00
revert: Use generate-changelog package
This commit is contained in:
10 files changed
+126
-145
No files matched your search
+5
-14
@@ -1,13 +1,11 @@
|
||||
import { info, getInput, setOutput, setFailed } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import Changelog from "generate-changelog";
|
||||
import { generate } from "./changelog";
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const token = getInput("token", { required: true });
|
||||
const exclude = getInput("exclude", { required: false }).split(",");
|
||||
const allowUnknown =
|
||||
getInput("allow-unknown", { required: false }) === "true";
|
||||
const octokit = getOctokit(token);
|
||||
const {
|
||||
repo: { owner, repo },
|
||||
@@ -20,22 +18,15 @@ async function run() {
|
||||
per_page: 2,
|
||||
});
|
||||
|
||||
let tag: string | undefined;
|
||||
let tagRef: string | undefined;
|
||||
|
||||
if (tags.length > 0) {
|
||||
if (sha === tags[0].commit.sha) {
|
||||
if (tags.length > 1) tag = tags[1].name;
|
||||
} else tag = tags[0].name;
|
||||
if (tags.length > 1) tagRef = tags[1].commit.sha;
|
||||
} else tagRef = tags[0].commit.sha;
|
||||
}
|
||||
|
||||
let changelog = await Changelog.generate({
|
||||
repoUrl: `https://github.com/${owner}/${repo}`,
|
||||
tag,
|
||||
exclude,
|
||||
allowUnknown,
|
||||
});
|
||||
|
||||
changelog = changelog.replace(/^#+ +(\d)/, "#### v$1");
|
||||
const changelog = await generate(octokit, exclude, owner, repo, tagRef);
|
||||
|
||||
info(changelog);
|
||||
|
||||
|
||||
Reference in new issue
Block a user