- fix formatting, and unused import

This commit is contained in:
Mike Penz
2020-10-17 19:42:26 +02:00
parent bd49950417
commit f63fa1dabb
8 changed files with 39 additions and 18 deletions
+3 -1
View File
@@ -54,7 +54,9 @@ export class Commits {
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 => ({
sha: commit.sha,
summary: commit.commit.message.split('\n')[0],
+1 -2
View File
@@ -1,7 +1,6 @@
import * as exec from '@actions/exec'
import * as fs from 'fs'
import * as io from '@actions/io'
import { directoryExistsSync } from './utils';
import {directoryExistsSync} from './utils'
export async function createCommandManager(
workingDirectory: string
+3 -1
View File
@@ -30,7 +30,9 @@ async function run(): Promise<void> {
core.debug(`configurationPath = '${configurationPath}'`)
const providedConfiguration = readConfiguration(configurationPath)
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 {
configuration = providedConfiguration
}
+3 -1
View File
@@ -55,7 +55,9 @@ export class PullRequests {
})
}
} catch (e) {
core.warning(`⚠️ Cannot find PR ${owner}/${repo}#${prNumber} - ${e.message}`)
core.warning(
`⚠️ Cannot find PR ${owner}/${repo}#${prNumber} - ${e.message}`
)
return null
}
}
+12 -5
View File
@@ -58,7 +58,7 @@ export class ReleaseNotes {
return configuration.empty_template ?? DefaultConfiguration.empty_template
}
core.startGroup("📦 Build changelog")
core.startGroup('📦 Build changelog')
const resultChangelog = buildChangelog(mergedPullRequests, configuration)
core.endGroup()
return resultChangelog
@@ -97,7 +97,9 @@ export class ReleaseNotes {
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 pullRequests = await pullRequestsApi.getBetweenDates(
@@ -108,14 +110,19 @@ export class ReleaseNotes {
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(
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 pullRequestsByNumber: {[key: number]: PullRequestInfo} = {}
+6 -2
View File
@@ -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
}
@@ -57,7 +59,9 @@ export class Tags {
for (let i = 0; i < length; i++) {
if (tags[i].name.toLowerCase() === tag.toLowerCase()) {
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++) {
if (!tags[ii].name.includes('-')) {
return tags[ii]
+10 -5
View File
@@ -13,8 +13,8 @@ export function buildChangelog(
): string {
// sort to target order
const sort = config.sort ?? DefaultConfiguration.sort
const sortAsc = (sort).toUpperCase() ==='ASC'
prs = sortPullRequests( prs, sortAsc)
const sortAsc = sort.toUpperCase() === 'ASC'
prs = sortPullRequests(prs, sortAsc)
core.info(`️ Sorted all pull requests ascending: ${sort}`)
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`)
// bring PRs into the order of categories
@@ -82,7 +84,9 @@ export function buildChangelog(
for (const pr of uncategorized) {
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
let transformedChangelog = config.template ?? DefaultConfiguration.template
@@ -137,7 +141,8 @@ function transform(filled: string, transformers: RegexTransformer[]): string {
function validateTransfomers(
specifiedTransformers: Transformer[]
): RegexTransformer[] {
const transformers = specifiedTransformers ?? DefaultConfiguration.transformers
const transformers =
specifiedTransformers ?? DefaultConfiguration.transformers
return transformers
.map(transformer => {
try {
+1 -1
View File
@@ -40,4 +40,4 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
}
throw new Error(`Directory '${path}' does not exist`)
}
}