fix spellings
This commit is contained in:
@@ -10,7 +10,7 @@ const token = process.env.GITHUB_TOKEN || ''
|
|||||||
const githubRepository = new GithubRepository(token, undefined, '.')
|
const githubRepository = new GithubRepository(token, undefined, '.')
|
||||||
it('Test custom changelog builder', async () => {
|
it('Test custom changelog builder', async () => {
|
||||||
// define the configuration file to use.
|
// define the configuration file to use.
|
||||||
// By default it retireves a configuration from a json file
|
// By default, it retrieves a configuration from a json file
|
||||||
// You can also quickly modify in code.
|
// You can also quickly modify in code.
|
||||||
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs/configuration.json'))
|
const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs/configuration.json'))
|
||||||
|
|
||||||
@@ -24,17 +24,17 @@ it('Test custom changelog builder', async () => {
|
|||||||
'mikepenz', // The owner of the repo to test
|
'mikepenz', // The owner of the repo to test
|
||||||
'release-changelog-builder-action-playground', // The repository name
|
'release-changelog-builder-action-playground', // The repository name
|
||||||
'1.5.0', // `fromTag` The from tag name or the SHA1 of the from commit
|
'1.5.0', // `fromTag` The from tag name or the SHA1 of the from commit
|
||||||
'2.0.0', // `toTag` The to tag name or the SHA1 of the to commit
|
'4.2.2', // `toTag` The to tag name or the SHA1 of the to commit
|
||||||
false, // `includeOpen` Define if you want to include open PRs into the changelog
|
false, // `includeOpen` Define if you want to include open PRs into the changelog
|
||||||
false, // `failOnError` Define if the action should fail on errors
|
false, // `failOnError` Define if the action should fail on errors
|
||||||
false, // `ignorePrePrelease` used if no `fromTag` is defined to resolve the prior tag
|
false, // `ignorePrePrerelease` used if no `fromTag` is defined to resolve the prior tag
|
||||||
false, // `fetchViaCommits` enable to fetch via commits
|
false, // `fetchViaCommits` enable to fetch via commits
|
||||||
false, // `fetchReviewers` Enables fetching of reviewers for building the changlog (does additional API requests)
|
false, // `fetchReviewers` Enables fetching of reviewers for building the changelog (does additional API requests)
|
||||||
false, // `fetchReleaseInformation` Enable to fetch release information (does additional API requests)
|
false, // `fetchReleaseInformation` Enable to fetch release information (does additional API requests)
|
||||||
false, // `fetchReviews` Enable to fetch reviews of the PRs (does additional API requests)
|
false, // `fetchReviews` Enable to fetch reviews of the PRs (does additional API requests)
|
||||||
'PR', // `mode` Set the mode to use [PR, COMMIT, HYBRID]. PR -> builds changelog using PRs, COMMIT -> using commits, HYBRID -> Uses both
|
'PR', // `mode` Set the mode to use [PR, COMMIT, HYBRID]. PR -> builds changelog using PRs, COMMIT -> using commits, HYBRID -> Uses both
|
||||||
false, // `exportCache` Exports the fethced information to the cahce. Not relevant for this test
|
false, // `exportCache` Exports the fetched information to the cache. Not relevant for this test
|
||||||
false, // `exportOnly` Enables to only export the fetched information however not build a changleog
|
false, // `exportOnly` Enables to only export the fetched information however not build a changelog
|
||||||
null, // `cache` Path to the cache. Not relevant for this test.
|
null, // `cache` Path to the cache. Not relevant for this test.
|
||||||
configuration // The configuration to use for building the changelog
|
configuration // The configuration to use for building the changelog
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export interface Category {
|
|||||||
empty_content?: string // if the category has no matching PRs, this content will be used. If not set, the category will be skipped in the changelog.
|
empty_content?: string // if the category has no matching PRs, this content will be used. If not set, the category will be skipped in the changelog.
|
||||||
categories?: Category[] // allows for nested categories, items matched for a child category won't show up in the parent
|
categories?: Category[] // allows for nested categories, items matched for a child category won't show up in the parent
|
||||||
consume?: boolean // defines if the matched PR will be consumed by this category. Consumed PRs won't show up in any category *after*
|
consume?: boolean // defines if the matched PR will be consumed by this category. Consumed PRs won't show up in any category *after*
|
||||||
entries?: string[] // array of single changelog entries, used to construc the changelog. (this is filled during the build)
|
entries?: string[] // array of single changelog entries, used to construct the changelog. (this is filled during the build)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,7 +60,7 @@ export interface TagResolver {
|
|||||||
export interface Placeholder {
|
export interface Placeholder {
|
||||||
name: string // the name of the new placeholder
|
name: string // the name of the new placeholder
|
||||||
source: string // the src placeholder which will be used to apply the transformer on
|
source: string // the src placeholder which will be used to apply the transformer on
|
||||||
transformer: Regex // the transformer to use to transform the original placeholder into the custom placheolder
|
transformer: Regex // the transformer to use to transform the original placeholder into the custom placeheolder
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DefaultConfiguration: Configuration = {
|
export const DefaultConfiguration: Configuration = {
|
||||||
@@ -94,13 +94,13 @@ export const DefaultConfiguration: Configuration = {
|
|||||||
labels: []
|
labels: []
|
||||||
}
|
}
|
||||||
], // the categories to support for the ordering
|
], // the categories to support for the ordering
|
||||||
ignore_labels: ['ignore'], // list of lables being ignored from the changelog
|
ignore_labels: ['ignore'], // list of labels being ignored from the changelog
|
||||||
label_extractor: [], // extracts additional labels from the commit message given a regex
|
label_extractor: [], // extracts additional labels from the commit message given a regex
|
||||||
duplicate_filter: undefined, // extract an identifier from a PR used to detect duplicates, will keep the last match (depends on `sort`)
|
duplicate_filter: undefined, // extract an identifier from a PR used to detect duplicates, will keep the last match (depends on `sort`)
|
||||||
transformers: [], // transformers to apply on the PR description according to the `pr_template`
|
transformers: [], // transformers to apply on the PR description according to the `pr_template`
|
||||||
tag_resolver: {
|
tag_resolver: {
|
||||||
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
|
// defines the logic on how to resolve the previous tag, only relevant if `fromTag` is not specified
|
||||||
method: 'semver', // defines which method to use, by default it will use `semver` (dropping all non matching tags). Alternative `sort` is also available.
|
method: 'semver', // defines which method to use, by default it will use `semver` (dropping all non-matching tags). Alternative `sort` is also available.
|
||||||
filter: undefined, // filter out all tags not matching the regex
|
filter: undefined, // filter out all tags not matching the regex
|
||||||
transformer: undefined // transforms the tag name using the regex, run after the filter
|
transformer: undefined // transforms the tag name using the regex, run after the filter
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -37,14 +37,14 @@ async function run(): Promise<void> {
|
|||||||
if (configurationJson) {
|
if (configurationJson) {
|
||||||
configJson = parseConfiguration(configurationJson)
|
configJson = parseConfiguration(configurationJson)
|
||||||
if (configJson) {
|
if (configJson) {
|
||||||
core.info(`ℹ️ Retreived configuration via 'configurationJson'.`)
|
core.info(`ℹ️ Retrieved configuration via 'configurationJson'.`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// read in the configuration from the file if possible
|
// read in the configuration from the file if possible
|
||||||
const configurationFile: string = core.getInput('configuration')
|
const configurationFile: string = core.getInput('configuration')
|
||||||
const configFile = resolveConfiguration(repositoryPath, configurationFile)
|
const configFile = resolveConfiguration(repositoryPath, configurationFile)
|
||||||
if (configFile) {
|
if (configFile) {
|
||||||
core.info(`ℹ️ Retreived configuration via 'configuration' (via file).`)
|
core.info(`ℹ️ Retrieved configuration via 'configuration' (via file).`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!configJson && !configFile) {
|
if (!configJson && !configFile) {
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ export class PullRequests {
|
|||||||
if (reviews && (reviews?.length || 0) > 0) {
|
if (reviews && (reviews?.length || 0) > 0) {
|
||||||
core.info(`ℹ️ Retrieved ${reviews.length || 0} review(s) for PR ${owner}/${repo}/#${pr.number}`)
|
core.info(`ℹ️ Retrieved ${reviews.length || 0} review(s) for PR ${owner}/${repo}/#${pr.number}`)
|
||||||
|
|
||||||
// backwards compatiblity
|
// backwards compatibility
|
||||||
pr.approvedReviewers = reviews.filter(r => r.state === 'APPROVED').map(r => r.author)
|
pr.approvedReviewers = reviews.filter(r => r.state === 'APPROVED').map(r => r.author)
|
||||||
} else {
|
} else {
|
||||||
core.debug(`No reviewer(s) for PR ${owner}/${repo}/#${pr.number}`)
|
core.debug(`No reviewer(s) for PR ${owner}/${repo}/#${pr.number}`)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export function transformStringToValue(value: string, extractor: RegexTransforme
|
|||||||
|
|
||||||
function transformRegexr(regex: RegExp, source: string, target: string): Set<string> | null {
|
function transformRegexr(regex: RegExp, source: string, target: string): Set<string> | null {
|
||||||
/**
|
/**
|
||||||
* Util funtion extracted from regexr and is licensed under:
|
* Util function extracted from regexr and is licensed under:
|
||||||
*
|
*
|
||||||
* RegExr: Learn, Build, & Test RegEx
|
* RegExr: Learn, Build, & Test RegEx
|
||||||
* Copyright (C) 2017 gskinner.com, inc.
|
* Copyright (C) 2017 gskinner.com, inc.
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export class GithubRepository extends BaseRepository {
|
|||||||
labels: this.attachSpecialLabels(status, pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase('en') || '') || []),
|
labels: this.attachSpecialLabels(status, pr.labels?.map(lbl => lbl.name?.toLocaleLowerCase('en') || '') || []),
|
||||||
milestone: pr.milestone?.title || '',
|
milestone: pr.milestone?.title || '',
|
||||||
body: pr.body || '',
|
body: pr.body || '',
|
||||||
assignees: pr.assignees?.map(asignee => asignee?.login || '') || [],
|
assignees: pr.assignees?.map(assignee => assignee?.login || '') || [],
|
||||||
requestedReviewers: pr.requested_reviewers?.map(reviewer => reviewer?.login || '') || [],
|
requestedReviewers: pr.requested_reviewers?.map(reviewer => reviewer?.login || '') || [],
|
||||||
approvedReviewers: [],
|
approvedReviewers: [],
|
||||||
reviews: undefined,
|
reviews: undefined,
|
||||||
|
|||||||
+2
-2
@@ -89,7 +89,7 @@ export function buildChangelog(diffInfo: DiffInfo, origPrs: PullRequestInfo[], o
|
|||||||
const deduplicatedMap = new Map<string, PullRequestInfo>()
|
const deduplicatedMap = new Map<string, PullRequestInfo>()
|
||||||
const unmatched: PullRequestInfo[] = []
|
const unmatched: PullRequestInfo[] = []
|
||||||
for (const pr of prs) {
|
for (const pr of prs) {
|
||||||
const extracted = extractValues(pr, extractor, 'dupliate_filter')
|
const extracted = extractValues(pr, extractor, 'duplicate_filter')
|
||||||
if (extracted !== null && extracted.length > 0) {
|
if (extracted !== null && extracted.length > 0) {
|
||||||
deduplicatedMap.set(extracted[0], pr)
|
deduplicatedMap.set(extracted[0], pr)
|
||||||
} else {
|
} else {
|
||||||
@@ -513,7 +513,7 @@ function handlePlaceholder(
|
|||||||
if (transformer?.pattern) {
|
if (transformer?.pattern) {
|
||||||
const extractedValue = transformStringToOptionalValue(value, transformer)
|
const extractedValue = transformStringToOptionalValue(value, transformer)
|
||||||
// note: `.replace` will return the full string again if there was no match
|
// note: `.replace` will return the full string again if there was no match
|
||||||
// note: This is mostly backwards compatiblity
|
// note: This is mostly backwards compatibility
|
||||||
if (extractedValue && ((transformer.method && transformer.method !== 'replace') || extractedValue !== value)) {
|
if (extractedValue && ((transformer.method && transformer.method !== 'replace') || extractedValue !== value)) {
|
||||||
if (placeholderPrMap) {
|
if (placeholderPrMap) {
|
||||||
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
|
createOrSet(placeholderPrMap, placeholder.name, extractedValue)
|
||||||
|
|||||||
+1
-1
@@ -179,7 +179,7 @@ function readConfiguration(filename: string): Configuration | undefined {
|
|||||||
*/
|
*/
|
||||||
export function parseConfiguration(config: string): Configuration | undefined {
|
export function parseConfiguration(config: string): Configuration | undefined {
|
||||||
try {
|
try {
|
||||||
// for compatiblity with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here.
|
// for compatibility with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here.
|
||||||
const configurationJSON: Configuration = JSON.parse(config.replace(/\${{/g, '#{{'))
|
const configurationJSON: Configuration = JSON.parse(config.replace(/\${{/g, '#{{'))
|
||||||
return configurationJSON
|
return configurationJSON
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user