mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
feat: add include-commit-links & include-pr-links action inputs (#136)
This commit is contained in:
1 parent
59a206c296
commit
479475eda0
7 files changed
+39042
-25
No files matched your search
@@ -149,6 +149,30 @@ _Default:_
|
||||
true
|
||||
```
|
||||
|
||||
#### `include-pr-links`
|
||||
|
||||
**(Optional)**
|
||||
|
||||
Include GitHub pull request links at each log if applicable.
|
||||
|
||||
_Default:_
|
||||
|
||||
```yaml
|
||||
true
|
||||
```
|
||||
|
||||
#### `include-commit-links`
|
||||
|
||||
**(Optional)**
|
||||
|
||||
Include GitHub commit links at each log.
|
||||
|
||||
_Default:_
|
||||
|
||||
```yaml
|
||||
true
|
||||
```
|
||||
|
||||
#### `semver`
|
||||
|
||||
**(Optional)**
|
||||
@@ -225,5 +249,7 @@ Using with custom inputs:
|
||||
mention-authors: true
|
||||
mention-new-contributors: true
|
||||
include-compare: true
|
||||
include-pr-lints: true
|
||||
include-commit-lints: true
|
||||
semver: true
|
||||
```
|
||||
+10
@@ -59,6 +59,16 @@ inputs:
|
||||
required: true
|
||||
default: 'true'
|
||||
|
||||
include-pr-links:
|
||||
description: Include GitHub pull request links at each log if applicable
|
||||
required: true
|
||||
default: 'true'
|
||||
|
||||
include-commit-links:
|
||||
description: Include GitHub commit links at each log
|
||||
required: true
|
||||
default: 'true'
|
||||
|
||||
semver:
|
||||
description: Enable semver based version comparison
|
||||
required: true
|
||||
|
||||
+38969
-2
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/constants.js","../webpack:/auto-changelog/dist/context.js","../webpack:/auto-changelog/dist/index.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/path-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/proxy.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/@hapi/topo/lib/index.js","../webpack:/auto-changelog/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/uri.js","../webpack:/auto-changelog/node_modules/@sideway/formula/lib/index.js","../webpack:/auto-changelog/node_modules/@sideway/pinpoint/lib/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changelog/node_modules/joi/lib/annotate.js","../webpack:/auto-changelog/node_modules/joi/lib/base.js","../webpack:/auto-changelog/node_modules/joi/lib/cache.js","../webpack:/auto-changelog/node_modules/joi/lib/common.js","../webpack:/auto-changelog/node_modules/joi/lib/compile.js","../webpack:/auto-changelog/node_modules/joi/lib/errors.js","../webpack:/auto-changelog/node_modules/joi/lib/extend.js","../webpack:/auto-changelog/node_modules/joi/lib/index.js","../webpack:/auto-changelog/node_modules/joi/lib/manifest.js","../webpack:/auto-changelog/node_modules/joi/lib/messages.js","../webpack:/auto-changelog/node_modules/joi/lib/modify.js","../webpack:/auto-changelog/node_modules/joi/lib/ref.js","../webpack:/auto-changelog/node_modules/joi/lib/schemas.js","../webpack:/auto-changelog/node_modules/joi/lib/state.js","../webpack:/auto-changelog/node_modules/joi/lib/template.js","../webpack:/auto-changelog/node_modules/joi/lib/trace.js","../webpack:/auto-changelog/node_modules/joi/lib/types/alternatives.js","../webpack:/auto-changelog/node_modules/joi/lib/types/Line truncated
|
||||
{"version":3,"file":"index.js","mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC/UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;Line truncated
|
||||
+26
-20
@@ -20,7 +20,7 @@ function unique(value: string[]): string[] {
|
||||
|
||||
export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
const { octokit, owner, repo, sha, tagRef, inputs } = input;
|
||||
const { commitTypes, defaultCommitType, mentionAuthors } = inputs;
|
||||
const { commitTypes, defaultCommitType, mentionAuthors, includePRLinks, includeCommitLinks } = inputs;
|
||||
|
||||
const repoUrl = `https://github.com/${ owner }/${ repo }`;
|
||||
const commits: LogsI = {};
|
||||
@@ -66,8 +66,8 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
|
||||
const reference: ReferenceI = {
|
||||
author: mentionAuthors ? commit.author?.login : null,
|
||||
commit: commit.sha,
|
||||
pr,
|
||||
commit: includeCommitLinks ? commit.sha : null,
|
||||
pr : includePRLinks ? pr : null,
|
||||
};
|
||||
|
||||
if (existingCommit == null) {
|
||||
@@ -102,23 +102,29 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
const baseLine = defaultCategory ? "" : " ";
|
||||
|
||||
for (const { title, references } of categoryGroup) {
|
||||
changelog.push(`${ baseLine }* ${ title } (${ references
|
||||
.map(reference => `${
|
||||
reference.pr == null ? "" : `${ repoUrl }/pull/${ reference.pr } `
|
||||
}${
|
||||
repoUrl
|
||||
}/commit/${
|
||||
reference.commit
|
||||
}${
|
||||
reference.author == null
|
||||
? ""
|
||||
: (
|
||||
reference.author.endsWith(APP_AUTHOR_SUFFIX)
|
||||
? ` by [@${ reference.author }](https://github.com/apps/${ reference.author.slice(0, -APP_AUTHOR_SUFFIX_LENGTH) })`
|
||||
: ` by @${ reference.author }`
|
||||
)
|
||||
}`)
|
||||
.join(", ") })`);
|
||||
let log = `${ baseLine }* ${ title }`;
|
||||
|
||||
const links: string[] = [];
|
||||
|
||||
for (const { pr, commit, author } of references) {
|
||||
const link: string[] = [];
|
||||
|
||||
if (pr != null) link.push(`${ repoUrl }/pull/${ pr }`);
|
||||
|
||||
if (commit != null) link.push(`${ repoUrl }/commit/${ commit }`);
|
||||
|
||||
if (author != null) {
|
||||
// eslint-disable-next-line max-depth
|
||||
if (author.endsWith(APP_AUTHOR_SUFFIX)) link.push(`by [@${ author }](https://github.com/apps/${ author.slice(0, -APP_AUTHOR_SUFFIX_LENGTH) })`);
|
||||
else link.push(`by @${ author }`);
|
||||
}
|
||||
|
||||
if (link.length > 0) links.push(link.join(" "));
|
||||
}
|
||||
|
||||
if (links.length > 0) log += ` (${ links.join(", ") })`;
|
||||
|
||||
changelog.push(log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -19,8 +19,8 @@ export interface LogI {
|
||||
|
||||
export interface ReferenceI {
|
||||
author?: string | null;
|
||||
commit: string;
|
||||
pr?: string;
|
||||
commit: string | null;
|
||||
pr?: string | null;
|
||||
}
|
||||
|
||||
export interface TagInputI {
|
||||
@@ -49,7 +49,9 @@ export interface ChangelogInputI {
|
||||
export interface ActionInputsI {
|
||||
commitTypes: TypesI;
|
||||
defaultCommitType: string;
|
||||
includeCommitLinks: boolean;
|
||||
includeCompare: boolean;
|
||||
includePRLinks: boolean;
|
||||
mentionAuthors: boolean;
|
||||
mentionNewContributors: boolean;
|
||||
releaseName: string;
|
||||
|
||||
@@ -16,6 +16,8 @@ export async function getInputs(): Promise<ActionInputsI> {
|
||||
required: true,
|
||||
});
|
||||
const includeCompare = getBooleanInput("include-compare", { required: true });
|
||||
const includePRLinks = getBooleanInput("include-pr-links", { required: true });
|
||||
const includeCommitLinks = getBooleanInput("include-commit-links", { required: true });
|
||||
const semver = getBooleanInput("semver", { required: true });
|
||||
|
||||
return Joi.object<ActionInputsI, true>()
|
||||
@@ -28,6 +30,8 @@ export async function getInputs(): Promise<ActionInputsI> {
|
||||
mentionAuthors : Joi.boolean().required(),
|
||||
mentionNewContributors: Joi.boolean().required(),
|
||||
includeCompare : Joi.boolean().required(),
|
||||
includePRLinks : Joi.boolean().required(),
|
||||
includeCommitLinks : Joi.boolean().required(),
|
||||
semver : Joi.boolean().required(),
|
||||
})
|
||||
.validateAsync({
|
||||
@@ -37,6 +41,8 @@ export async function getInputs(): Promise<ActionInputsI> {
|
||||
mentionAuthors,
|
||||
mentionNewContributors,
|
||||
includeCompare,
|
||||
includePRLinks,
|
||||
includeCommitLinks,
|
||||
semver,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user