revert: Use generate-changelog package

This commit is contained in:
Ardalan Amini committed 2020-09-28 21:03:56 +03:30
1 parent bf85019aca
commit 25bed3a982
10 files changed
+126 -145

No files matched your search

+5 -14
View File
@@ -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);