- fix formatting, and unused import
This commit is contained in:
+3
-1
@@ -54,7 +54,9 @@ export class Commits {
|
|||||||
compareHead = `${commits[0].sha}^`
|
compareHead = `${commits[0].sha}^`
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`ℹ️ Found ${commits.length} commits from the GitHub API for ${owner}/${repo}`)
|
core.info(
|
||||||
|
`ℹ️ Found ${commits.length} commits from the GitHub API for ${owner}/${repo}`
|
||||||
|
)
|
||||||
return commits.map(commit => ({
|
return commits.map(commit => ({
|
||||||
sha: commit.sha,
|
sha: commit.sha,
|
||||||
summary: commit.commit.message.split('\n')[0],
|
summary: commit.commit.message.split('\n')[0],
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import { directoryExistsSync } from './utils';
|
import {directoryExistsSync} from './utils'
|
||||||
|
|
||||||
export async function createCommandManager(
|
export async function createCommandManager(
|
||||||
workingDirectory: string
|
workingDirectory: string
|
||||||
|
|||||||
+3
-1
@@ -30,7 +30,9 @@ async function run(): Promise<void> {
|
|||||||
core.debug(`configurationPath = '${configurationPath}'`)
|
core.debug(`configurationPath = '${configurationPath}'`)
|
||||||
const providedConfiguration = readConfiguration(configurationPath)
|
const providedConfiguration = readConfiguration(configurationPath)
|
||||||
if (!providedConfiguration) {
|
if (!providedConfiguration) {
|
||||||
core.info(`⚠️ Configuration provided, but it couldn't be found, or failed to parse. Fallback to Defaults`)
|
core.info(
|
||||||
|
`⚠️ Configuration provided, but it couldn't be found, or failed to parse. Fallback to Defaults`
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
configuration = providedConfiguration
|
configuration = providedConfiguration
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -55,7 +55,9 @@ export class PullRequests {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.warning(`⚠️ Cannot find PR ${owner}/${repo}#${prNumber} - ${e.message}`)
|
core.warning(
|
||||||
|
`⚠️ Cannot find PR ${owner}/${repo}#${prNumber} - ${e.message}`
|
||||||
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-5
@@ -58,7 +58,7 @@ export class ReleaseNotes {
|
|||||||
return configuration.empty_template ?? DefaultConfiguration.empty_template
|
return configuration.empty_template ?? DefaultConfiguration.empty_template
|
||||||
}
|
}
|
||||||
|
|
||||||
core.startGroup("📦 Build changelog")
|
core.startGroup('📦 Build changelog')
|
||||||
const resultChangelog = buildChangelog(mergedPullRequests, configuration)
|
const resultChangelog = buildChangelog(mergedPullRequests, configuration)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
return resultChangelog
|
return resultChangelog
|
||||||
@@ -97,7 +97,9 @@ export class ReleaseNotes {
|
|||||||
fromDate = maxFromDate
|
fromDate = maxFromDate
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`ℹ️ Fetching PRs between dates ${fromDate.toISOString()} to ${toDate.toISOString()} for ${owner}/${repo}`)
|
core.info(
|
||||||
|
`ℹ️ Fetching PRs between dates ${fromDate.toISOString()} to ${toDate.toISOString()} for ${owner}/${repo}`
|
||||||
|
)
|
||||||
|
|
||||||
const pullRequestsApi = new PullRequests(octokit)
|
const pullRequestsApi = new PullRequests(octokit)
|
||||||
const pullRequests = await pullRequestsApi.getBetweenDates(
|
const pullRequests = await pullRequestsApi.getBetweenDates(
|
||||||
@@ -108,14 +110,19 @@ export class ReleaseNotes {
|
|||||||
configuration.max_pull_requests ?? DefaultConfiguration.max_pull_requests
|
configuration.max_pull_requests ?? DefaultConfiguration.max_pull_requests
|
||||||
)
|
)
|
||||||
|
|
||||||
core.info(`ℹ️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}`)
|
core.info(
|
||||||
|
`ℹ️ Retrieved ${pullRequests.length} merged PRs for ${owner}/${repo}`
|
||||||
|
)
|
||||||
|
|
||||||
const prCommits = pullRequestsApi.filterCommits(
|
const prCommits = pullRequestsApi.filterCommits(
|
||||||
commits,
|
commits,
|
||||||
configuration.exclude_merge_branches ?? DefaultConfiguration.exclude_merge_branches
|
configuration.exclude_merge_branches ??
|
||||||
|
DefaultConfiguration.exclude_merge_branches
|
||||||
)
|
)
|
||||||
|
|
||||||
core.info(`ℹ️ Retrieved ${prCommits.length} PR merge commits for ${owner}/${repo}`)
|
core.info(
|
||||||
|
`ℹ️ Retrieved ${prCommits.length} PR merge commits for ${owner}/${repo}`
|
||||||
|
)
|
||||||
|
|
||||||
const filteredPullRequests = []
|
const filteredPullRequests = []
|
||||||
const pullRequestsByNumber: {[key: number]: PullRequestInfo} = {}
|
const pullRequestsByNumber: {[key: number]: PullRequestInfo} = {}
|
||||||
|
|||||||
+6
-2
@@ -39,7 +39,9 @@ export class Tags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`ℹ️ Found ${tagsInfo.length} (fetching max: ${maxTagsToFetch}) tags from the GitHub API for ${owner}/${repo}`)
|
core.info(
|
||||||
|
`ℹ️ Found ${tagsInfo.length} (fetching max: ${maxTagsToFetch}) tags from the GitHub API for ${owner}/${repo}`
|
||||||
|
)
|
||||||
return tagsInfo
|
return tagsInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +59,9 @@ export class Tags {
|
|||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (tags[i].name.toLowerCase() === tag.toLowerCase()) {
|
if (tags[i].name.toLowerCase() === tag.toLowerCase()) {
|
||||||
if (ignorePreReleases) {
|
if (ignorePreReleases) {
|
||||||
core.info(`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`)
|
core.info(
|
||||||
|
`ℹ️ Enabled 'ignorePreReleases', searching for the closest release`
|
||||||
|
)
|
||||||
for (let ii = i + 1; ii < length; ii++) {
|
for (let ii = i + 1; ii < length; ii++) {
|
||||||
if (!tags[ii].name.includes('-')) {
|
if (!tags[ii].name.includes('-')) {
|
||||||
return tags[ii]
|
return tags[ii]
|
||||||
|
|||||||
+10
-5
@@ -13,8 +13,8 @@ export function buildChangelog(
|
|||||||
): string {
|
): string {
|
||||||
// sort to target order
|
// sort to target order
|
||||||
const sort = config.sort ?? DefaultConfiguration.sort
|
const sort = config.sort ?? DefaultConfiguration.sort
|
||||||
const sortAsc = (sort).toUpperCase() ==='ASC'
|
const sortAsc = sort.toUpperCase() === 'ASC'
|
||||||
prs = sortPullRequests( prs, sortAsc)
|
prs = sortPullRequests(prs, sortAsc)
|
||||||
core.info(`ℹ️ Sorted all pull requests ascending: ${sort}`)
|
core.info(`ℹ️ Sorted all pull requests ascending: ${sort}`)
|
||||||
|
|
||||||
const validatedTransformers = validateTransfomers(config.transformers)
|
const validatedTransformers = validateTransfomers(config.transformers)
|
||||||
@@ -34,7 +34,9 @@ export function buildChangelog(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
core.info(`ℹ️ Used ${validateTransfomers.length} transformers to adjust message`)
|
core.info(
|
||||||
|
`ℹ️ Used ${validateTransfomers.length} transformers to adjust message`
|
||||||
|
)
|
||||||
core.info(`✒️ Wrote messages for ${prs.length} pull requests`)
|
core.info(`✒️ Wrote messages for ${prs.length} pull requests`)
|
||||||
|
|
||||||
// bring PRs into the order of categories
|
// bring PRs into the order of categories
|
||||||
@@ -82,7 +84,9 @@ export function buildChangelog(
|
|||||||
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`)
|
core.info(
|
||||||
|
`✒️ Wrote ${changelogUncategorized.length} non categorized pull requests down`
|
||||||
|
)
|
||||||
|
|
||||||
// fill template
|
// fill template
|
||||||
let transformedChangelog = config.template ?? DefaultConfiguration.template
|
let transformedChangelog = config.template ?? DefaultConfiguration.template
|
||||||
@@ -137,7 +141,8 @@ function transform(filled: string, transformers: RegexTransformer[]): string {
|
|||||||
function validateTransfomers(
|
function validateTransfomers(
|
||||||
specifiedTransformers: Transformer[]
|
specifiedTransformers: Transformer[]
|
||||||
): RegexTransformer[] {
|
): RegexTransformer[] {
|
||||||
const transformers = specifiedTransformers ?? DefaultConfiguration.transformers
|
const transformers =
|
||||||
|
specifiedTransformers ?? DefaultConfiguration.transformers
|
||||||
return transformers
|
return transformers
|
||||||
.map(transformer => {
|
.map(transformer => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -40,4 +40,4 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Directory '${path}' does not exist`)
|
throw new Error(`Directory '${path}' does not exist`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user