- add more log messages to action

This commit is contained in:
Mike Penz
2020-10-17 19:37:11 +02:00
parent f675789732
commit 1e0f6ab49e
5 changed files with 32 additions and 28 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<div align="center"> <div align="center">
:octocat: :octocat:📄🔖📦
</div> </div>
<h1 align="center"> <h1 align="center">
release-changelog-builder-action release-changelog-builder-action
Generated Vendored
+16 -12
View File
@@ -674,7 +674,7 @@ class ReleaseNotes {
}); });
const { owner, repo, toTag, ignorePreReleases, configuration } = this.options; const { owner, repo, toTag, ignorePreReleases, configuration } = this.options;
if (!this.options.fromTag) { if (!this.options.fromTag) {
core.startGroup(`:bookmark: Resolve 'fromTag'`); core.startGroup(`🔖 Resolve 'fromTag'`);
core.debug(`fromTag undefined, trying to resolve via API`); core.debug(`fromTag undefined, trying to resolve via API`);
const tagsApi = new tags_1.Tags(octokit); const tagsApi = new tags_1.Tags(octokit);
const previousTag = yield tagsApi.findPredecessorTag(owner, repo, toTag, ignorePreReleases, (_a = configuration.max_tags_to_fetch) !== null && _a !== void 0 ? _a : configuration_1.DefaultConfiguration.max_tags_to_fetch); const previousTag = yield tagsApi.findPredecessorTag(owner, repo, toTag, ignorePreReleases, (_a = configuration.max_tags_to_fetch) !== null && _a !== void 0 ? _a : configuration_1.DefaultConfiguration.max_tags_to_fetch);
@@ -703,7 +703,7 @@ class ReleaseNotes {
var _a, _b, _c; var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { owner, repo, fromTag, toTag, configuration } = this.options; const { owner, repo, fromTag, toTag, configuration } = this.options;
core.info(`️ Comparing ${owner}/${repo} - ${fromTag}...${toTag}`); core.info(`️ Comparing ${owner}/${repo} - '${fromTag}...${toTag}'`);
const commitsApi = new commits_1.Commits(octokit); const commitsApi = new commits_1.Commits(octokit);
let commits; let commits;
try { try {
@@ -949,10 +949,12 @@ const pullRequests_1 = __webpack_require__(4217);
const core = __importStar(__webpack_require__(2186)); const core = __importStar(__webpack_require__(2186));
const configuration_1 = __webpack_require__(5527); const configuration_1 = __webpack_require__(5527);
function buildChangelog(prs, config) { function buildChangelog(prs, config) {
var _a; var _a, _b, _c;
// sort to target order // sort to target order
prs = pullRequests_1.sortPullRequests(prs, (config.sort ? config.sort : configuration_1.DefaultConfiguration.sort).toUpperCase() === const sort = (_a = config.sort) !== null && _a !== void 0 ? _a : configuration_1.DefaultConfiguration.sort;
'ASC'); const sortAsc = (sort).toUpperCase() === 'ASC';
prs = pullRequests_1.sortPullRequests(prs, sortAsc);
core.info(`️ Sorted all pull requests ascending: ${sort}`);
const validatedTransformers = validateTransfomers(config.transformers); const validatedTransformers = validateTransfomers(config.transformers);
const transformedMap = new Map(); const transformedMap = new Map();
// convert PRs to their text representation // convert PRs to their text representation
@@ -961,9 +963,11 @@ function buildChangelog(prs, config) {
? config.pr_template ? config.pr_template
: configuration_1.DefaultConfiguration.pr_template), validatedTransformers)); : configuration_1.DefaultConfiguration.pr_template), validatedTransformers));
} }
core.info(`️ Used ${validateTransfomers.length} transformers to adjust message`);
core.info(`✏️ Wrote messages for ${prs.length} pull requests`);
// bring PRs into the order of categories // bring PRs into the order of categories
const categorized = new Map(); const categorized = new Map();
const categories = (_a = config.categories) !== null && _a !== void 0 ? _a : configuration_1.DefaultConfiguration.categories; const categories = (_b = config.categories) !== null && _b !== void 0 ? _b : configuration_1.DefaultConfiguration.categories;
for (const category of categories) { for (const category of categories) {
categorized.set(category, []); categorized.set(category, []);
} }
@@ -981,6 +985,7 @@ function buildChangelog(prs, config) {
uncategorized.push(body); uncategorized.push(body);
} }
} }
core.info(`️ Ordered all pull requests into ${categories.length} categories`);
// construct final changelog // construct final changelog
let changelog = ''; let changelog = '';
for (const [category, pullRequests] of categorized) { for (const [category, pullRequests] of categorized) {
@@ -993,16 +998,17 @@ function buildChangelog(prs, config) {
changelog = `${changelog}\n`; changelog = `${changelog}\n`;
} }
} }
core.info(`✏️ Wrote ${categorized.size} categorized pull requests down`);
let changelogUncategorized = ''; let changelogUncategorized = '';
for (const pr of uncategorized) { for (const pr of uncategorized) {
changelogUncategorized = `${changelogUncategorized + pr}\n`; changelogUncategorized = `${changelogUncategorized + pr}\n`;
} }
core.info(`✏️ Wrote ${changelogUncategorized.length} non categorized pull requests down`);
// fill template // fill template
let transformedChangelog = config.template let transformedChangelog = (_c = config.template) !== null && _c !== void 0 ? _c : configuration_1.DefaultConfiguration.template;
? config.template
: configuration_1.DefaultConfiguration.template;
transformedChangelog = transformedChangelog.replace('${{CHANGELOG}}', changelog); transformedChangelog = transformedChangelog.replace('${{CHANGELOG}}', changelog);
transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED}}', changelogUncategorized); transformedChangelog = transformedChangelog.replace('${{UNCATEGORIZED}}', changelogUncategorized);
core.info(`️ Filled template`);
return transformedChangelog; return transformedChangelog;
} }
exports.buildChangelog = buildChangelog; exports.buildChangelog = buildChangelog;
@@ -1035,9 +1041,7 @@ function transform(filled, transformers) {
return transformed; return transformed;
} }
function validateTransfomers(specifiedTransformers) { function validateTransfomers(specifiedTransformers) {
const transformers = specifiedTransformers const transformers = specifiedTransformers !== null && specifiedTransformers !== void 0 ? specifiedTransformers : configuration_1.DefaultConfiguration.transformers;
? specifiedTransformers
: configuration_1.DefaultConfiguration.transformers;
return transformers return transformers
.map(transformer => { .map(transformer => {
try { try {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -26,7 +26,7 @@ export class ReleaseNotes {
const {owner, repo, toTag, ignorePreReleases, configuration} = this.options const {owner, repo, toTag, ignorePreReleases, configuration} = this.options
if (!this.options.fromTag) { if (!this.options.fromTag) {
core.startGroup(`:bookmark: Resolve 'fromTag'`) core.startGroup(`🔖 Resolve 'fromTag'`)
core.debug(`fromTag undefined, trying to resolve via API`) core.debug(`fromTag undefined, trying to resolve via API`)
const tagsApi = new Tags(octokit) const tagsApi = new Tags(octokit)
@@ -68,7 +68,7 @@ export class ReleaseNotes {
octokit: Octokit octokit: Octokit
): Promise<PullRequestInfo[]> { ): Promise<PullRequestInfo[]> {
const {owner, repo, fromTag, toTag, configuration} = this.options const {owner, repo, fromTag, toTag, configuration} = this.options
core.info(`️ Comparing ${owner}/${repo} - ${fromTag}...${toTag}`) core.info(`️ Comparing ${owner}/${repo} - '${fromTag}...${toTag}'`)
const commitsApi = new Commits(octokit) const commitsApi = new Commits(octokit)
let commits: CommitInfo[] let commits: CommitInfo[]
+12 -12
View File
@@ -12,11 +12,10 @@ export function buildChangelog(
config: Configuration config: Configuration
): string { ): string {
// sort to target order // sort to target order
prs = sortPullRequests( const sort = config.sort ?? DefaultConfiguration.sort
prs, const sortAsc = (sort).toUpperCase() ==='ASC'
(config.sort ? config.sort : DefaultConfiguration.sort).toUpperCase() === prs = sortPullRequests( prs, sortAsc)
'ASC' core.info(`️ Sorted all pull requests ascending: ${sort}`)
)
const validatedTransformers = validateTransfomers(config.transformers) const validatedTransformers = validateTransfomers(config.transformers)
const transformedMap = new Map<PullRequestInfo, string>() const transformedMap = new Map<PullRequestInfo, string>()
@@ -35,6 +34,8 @@ export function buildChangelog(
) )
) )
} }
core.info(`️ Used ${validateTransfomers.length} transformers to adjust message`)
core.info(`✏️ Wrote messages for ${prs.length} pull requests`)
// bring PRs into the order of categories // bring PRs into the order of categories
const categorized = new Map<Category, string[]>() const categorized = new Map<Category, string[]>()
@@ -59,6 +60,7 @@ export function buildChangelog(
uncategorized.push(body) uncategorized.push(body)
} }
} }
core.info(`️ Ordered all pull requests into ${categories.length} categories`)
// construct final changelog // construct final changelog
let changelog = '' let changelog = ''
@@ -74,16 +76,16 @@ export function buildChangelog(
changelog = `${changelog}\n` changelog = `${changelog}\n`
} }
} }
core.info(`✏️ Wrote ${categorized.size} categorized pull requests down`)
let changelogUncategorized = '' let changelogUncategorized = ''
for (const pr of uncategorized) { for (const pr of uncategorized) {
changelogUncategorized = `${changelogUncategorized + pr}\n` changelogUncategorized = `${changelogUncategorized + pr}\n`
} }
core.info(`✏️ Wrote ${changelogUncategorized.length} non categorized pull requests down`)
// fill template // fill template
let transformedChangelog = config.template let transformedChangelog = config.template ?? DefaultConfiguration.template
? config.template
: DefaultConfiguration.template
transformedChangelog = transformedChangelog.replace( transformedChangelog = transformedChangelog.replace(
'${{CHANGELOG}}', '${{CHANGELOG}}',
changelog changelog
@@ -92,6 +94,7 @@ export function buildChangelog(
'${{UNCATEGORIZED}}', '${{UNCATEGORIZED}}',
changelogUncategorized changelogUncategorized
) )
core.info(`️ Filled template`)
return transformedChangelog return transformedChangelog
} }
@@ -134,10 +137,7 @@ function transform(filled: string, transformers: RegexTransformer[]): string {
function validateTransfomers( function validateTransfomers(
specifiedTransformers: Transformer[] specifiedTransformers: Transformer[]
): RegexTransformer[] { ): RegexTransformer[] {
const transformers = specifiedTransformers const transformers = specifiedTransformers ?? DefaultConfiguration.transformers
? specifiedTransformers
: DefaultConfiguration.transformers
return transformers return transformers
.map(transformer => { .map(transformer => {
try { try {