Merge pull request #1182 from mikepenz/feature/export_cache
Enable cache via `exportCache` configuration option
This commit is contained in:
@@ -131,6 +131,7 @@ jobs:
|
|||||||
fromTag: "v8.1.0"
|
fromTag: "v8.1.0"
|
||||||
toTag: "v8.1.6"
|
toTag: "v8.1.6"
|
||||||
token: ${{ secrets.PERSONAL_TOKEN }}
|
token: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
|
exportCache: true
|
||||||
exportOnly: true
|
exportOnly: true
|
||||||
|
|
||||||
- name: "External Repo Configuration"
|
- name: "External Repo Configuration"
|
||||||
|
|||||||
@@ -588,20 +588,22 @@ it('Test custom changelog builder', async () => {
|
|||||||
'release-changelog-builder-action-playground', // repo
|
'release-changelog-builder-action-playground', // repo
|
||||||
'1.5.0', // fromTag
|
'1.5.0', // fromTag
|
||||||
'2.0.0', // toTag
|
'2.0.0', // toTag
|
||||||
true, // includeOpen
|
false, // includeOpen
|
||||||
false, // failOnError
|
false, // failOnError
|
||||||
false, // ignorePrePrelease
|
false, // ignorePrePrelease
|
||||||
true, // enable to fetch reviewers
|
false, // enable to fetch via commits
|
||||||
|
false, // enable to fetch reviewers
|
||||||
false, // enable to fetch release information
|
false, // enable to fetch release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
|
|
||||||
const changeLog = await releaseNotesBuilder.build()
|
const changeLog = await releaseNotesBuilder.build()
|
||||||
console.log(changeLog)
|
console.log(changeLog)
|
||||||
expect(changeLog).toStrictEqual(``)
|
expect(changeLog).toStrictEqual(`define-expected-output`)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ it('Should match generated changelog (unspecified fromTag)', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -53,6 +54,7 @@ it('Should match generated changelog (unspecified tags)', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -80,6 +82,7 @@ it('Should use empty placeholder', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -107,6 +110,7 @@ it('Should fill empty placeholders', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -136,6 +140,7 @@ it('Should fill `template` placeholders', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -166,6 +171,7 @@ it('Should fill `template` placeholders, ignore', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -195,6 +201,7 @@ it('Uncategorized category', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -224,6 +231,7 @@ it('Verify commit based changelog', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
true, // enable commitMode
|
true, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -253,6 +261,7 @@ it('Verify commit based changelog, with emoji categorisation', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
true, // enable commitMode
|
true, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration
|
configuration
|
||||||
)
|
)
|
||||||
@@ -282,6 +291,7 @@ it('Verify default inclusion of open PRs', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
@@ -311,6 +321,7 @@ it('Verify custom categorisation of open PRs', async () => {
|
|||||||
false, // enable to fetch tag release information
|
false, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
@@ -340,6 +351,7 @@ it('Verify reviewers who approved are fetched and also release information', asy
|
|||||||
true, // enable to fetch tag release information
|
true, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
@@ -370,6 +382,7 @@ it('Fetch release information', async () => {
|
|||||||
true, // enable to fetch tag release information
|
true, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
@@ -398,6 +411,7 @@ it('Fetch release information for non existing tag / release', async () => {
|
|||||||
true, // enable to fetch tag release information
|
true, // enable to fetch tag release information
|
||||||
false, // enable to fetch reviews
|
false, // enable to fetch reviews
|
||||||
false, // enable commitMode
|
false, // enable commitMode
|
||||||
|
false, // enable exportCache
|
||||||
false, // enable exportOnly
|
false, // enable exportOnly
|
||||||
configuration // configuration
|
configuration // configuration
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-2
@@ -43,8 +43,11 @@ inputs:
|
|||||||
commitMode:
|
commitMode:
|
||||||
description: 'Enables a `light` commit based mode. This mode generates changelogs based on the commits. Please note that this is not officially supported, and lacks a lot of features only possible with PRs.'
|
description: 'Enables a `light` commit based mode. This mode generates changelogs based on the commits. Please note that this is not officially supported, and lacks a lot of features only possible with PRs.'
|
||||||
default: "false"
|
default: "false"
|
||||||
|
exportCache:
|
||||||
|
description: 'If enabled, the action will export the collected data to the cache. This is disabled by default. Can be passed to a follow up run via `cache`.'
|
||||||
|
default: "false"
|
||||||
exportOnly:
|
exportOnly:
|
||||||
description: 'If enabled, the action will only collect the data and terminate afterwards. Data can then be consumed by steps afterwards'
|
description: 'If enabled, the action will only collect the data and terminate afterwards. Data can then be consumed by steps afterwards. This requires `exportCache` to be enabled'
|
||||||
default: "false"
|
default: "false"
|
||||||
outputFile:
|
outputFile:
|
||||||
description: 'If defined, the changelog will get written to this file. (relative to the checkout dir)'
|
description: 'If defined, the changelog will get written to this file. (relative to the checkout dir)'
|
||||||
@@ -54,7 +57,7 @@ inputs:
|
|||||||
baseUrl:
|
baseUrl:
|
||||||
description: 'Defines the base url for GitHub Enterprise authentication, uses `https://api.github.com` by default'
|
description: 'Defines the base url for GitHub Enterprise authentication, uses `https://api.github.com` by default'
|
||||||
cache:
|
cache:
|
||||||
description: 'Provide the cache of a previous run. Allows to re-use collected information multiple times to generate different release notes.'
|
description: 'Provide the cache of a previous run. Allows to re-use collected information multiple times to generate different release notes. Requires `exportCache` to be enabled for the previous run.'
|
||||||
outputs:
|
outputs:
|
||||||
changelog:
|
changelog:
|
||||||
description: The built release changelog built from the merged pull requests
|
description: The built release changelog built from the merged pull requests
|
||||||
|
|||||||
+6
-2
@@ -146,8 +146,9 @@ function run() {
|
|||||||
const fetchReleaseInformation = core.getInput('fetchReleaseInformation') === 'true';
|
const fetchReleaseInformation = core.getInput('fetchReleaseInformation') === 'true';
|
||||||
const fetchReviews = core.getInput('fetchReviews') === 'true';
|
const fetchReviews = core.getInput('fetchReviews') === 'true';
|
||||||
const commitMode = core.getInput('commitMode') === 'true';
|
const commitMode = core.getInput('commitMode') === 'true';
|
||||||
|
const exportCache = core.getInput('exportCache') === 'true';
|
||||||
const exportOnly = core.getInput('exportOnly') === 'true';
|
const exportOnly = core.getInput('exportOnly') === 'true';
|
||||||
const result = yield new releaseNotesBuilder_1.ReleaseNotesBuilder(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, includeOpen, failOnError, ignorePreReleases, fetchViaCommits, fetchReviewers, fetchReleaseInformation, fetchReviews, commitMode, exportOnly, configuration).build();
|
const result = yield new releaseNotesBuilder_1.ReleaseNotesBuilder(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, includeOpen, failOnError, ignorePreReleases, fetchViaCommits, fetchReviewers, fetchReleaseInformation, fetchReviews, commitMode, exportCache, exportOnly, configuration).build();
|
||||||
core.setOutput('changelog', result);
|
core.setOutput('changelog', result);
|
||||||
// write the result in changelog to file if possible
|
// write the result in changelog to file if possible
|
||||||
const outputFile = core.getInput('outputFile');
|
const outputFile = core.getInput('outputFile');
|
||||||
@@ -283,7 +284,7 @@ const transform_1 = __nccwpck_require__(1644);
|
|||||||
const github_pr_collector_1 = __nccwpck_require__(3196);
|
const github_pr_collector_1 = __nccwpck_require__(3196);
|
||||||
const utils_2 = __nccwpck_require__(853);
|
const utils_2 = __nccwpck_require__(853);
|
||||||
class ReleaseNotesBuilder {
|
class ReleaseNotesBuilder {
|
||||||
constructor(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, includeOpen = false, failOnError, ignorePreReleases, fetchViaCommits = false, fetchReviewers = false, fetchReleaseInformation = false, fetchReviews = false, commitMode = false, exportOnly = false, configuration) {
|
constructor(baseUrl, token, repositoryPath, owner, repo, fromTag, toTag, includeOpen = false, failOnError, ignorePreReleases, fetchViaCommits = false, fetchReviewers = false, fetchReleaseInformation = false, fetchReviews = false, commitMode = false, exportCache = false, exportOnly = false, configuration) {
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
this.repositoryPath = repositoryPath;
|
this.repositoryPath = repositoryPath;
|
||||||
@@ -299,6 +300,7 @@ class ReleaseNotesBuilder {
|
|||||||
this.fetchReleaseInformation = fetchReleaseInformation;
|
this.fetchReleaseInformation = fetchReleaseInformation;
|
||||||
this.fetchReviews = fetchReviews;
|
this.fetchReviews = fetchReviews;
|
||||||
this.commitMode = commitMode;
|
this.commitMode = commitMode;
|
||||||
|
this.exportCache = exportCache;
|
||||||
this.exportOnly = exportOnly;
|
this.exportOnly = exportOnly;
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
}
|
}
|
||||||
@@ -341,6 +343,7 @@ class ReleaseNotesBuilder {
|
|||||||
const mergedPullRequests = prData.mergedPullRequests;
|
const mergedPullRequests = prData.mergedPullRequests;
|
||||||
const diffInfo = prData.diffInfo;
|
const diffInfo = prData.diffInfo;
|
||||||
this.setOutputs(options, diffInfo, mergedPullRequests);
|
this.setOutputs(options, diffInfo, mergedPullRequests);
|
||||||
|
if (this.exportCache) {
|
||||||
const cache = {
|
const cache = {
|
||||||
mergedPullRequests,
|
mergedPullRequests,
|
||||||
diffInfo,
|
diffInfo,
|
||||||
@@ -353,6 +356,7 @@ class ReleaseNotesBuilder {
|
|||||||
core.endGroup();
|
core.endGroup();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (0, transform_1.buildChangelog)(diffInfo, mergedPullRequests, options);
|
return (0, transform_1.buildChangelog)(diffInfo, mergedPullRequests, options);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -55,6 +55,7 @@ async function run(): Promise<void> {
|
|||||||
const fetchReleaseInformation = core.getInput('fetchReleaseInformation') === 'true'
|
const fetchReleaseInformation = core.getInput('fetchReleaseInformation') === 'true'
|
||||||
const fetchReviews = core.getInput('fetchReviews') === 'true'
|
const fetchReviews = core.getInput('fetchReviews') === 'true'
|
||||||
const commitMode = core.getInput('commitMode') === 'true'
|
const commitMode = core.getInput('commitMode') === 'true'
|
||||||
|
const exportCache = core.getInput('exportCache') === 'true'
|
||||||
const exportOnly = core.getInput('exportOnly') === 'true'
|
const exportOnly = core.getInput('exportOnly') === 'true'
|
||||||
|
|
||||||
const result = await new ReleaseNotesBuilder(
|
const result = await new ReleaseNotesBuilder(
|
||||||
@@ -73,6 +74,7 @@ async function run(): Promise<void> {
|
|||||||
fetchReleaseInformation,
|
fetchReleaseInformation,
|
||||||
fetchReviews,
|
fetchReviews,
|
||||||
commitMode,
|
commitMode,
|
||||||
|
exportCache,
|
||||||
exportOnly,
|
exportOnly,
|
||||||
configuration
|
configuration
|
||||||
).build()
|
).build()
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export class ReleaseNotesBuilder {
|
|||||||
private fetchReleaseInformation: boolean = false,
|
private fetchReleaseInformation: boolean = false,
|
||||||
private fetchReviews: boolean = false,
|
private fetchReviews: boolean = false,
|
||||||
private commitMode: boolean = false,
|
private commitMode: boolean = false,
|
||||||
|
private exportCache: boolean = false,
|
||||||
private exportOnly: boolean = false,
|
private exportOnly: boolean = false,
|
||||||
private configuration: Configuration
|
private configuration: Configuration
|
||||||
) {}
|
) {}
|
||||||
@@ -107,6 +108,7 @@ export class ReleaseNotesBuilder {
|
|||||||
const diffInfo = prData.diffInfo
|
const diffInfo = prData.diffInfo
|
||||||
this.setOutputs(options, diffInfo, mergedPullRequests)
|
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||||
|
|
||||||
|
if (this.exportCache) {
|
||||||
const cache = {
|
const cache = {
|
||||||
mergedPullRequests,
|
mergedPullRequests,
|
||||||
diffInfo,
|
diffInfo,
|
||||||
@@ -120,6 +122,7 @@ export class ReleaseNotesBuilder {
|
|||||||
core.endGroup()
|
core.endGroup()
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return buildChangelog(diffInfo, mergedPullRequests, options)
|
return buildChangelog(diffInfo, mergedPullRequests, options)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user