Merge pull request #1164 from mikepenz/feature/improve_output_from_cache
Consistently apply output when loading data from cache
This commit is contained in:
+19
-15
@@ -309,7 +309,6 @@ class ReleaseNotesBuilder {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
core.setOutput('owner', this.owner);
|
||||
core.debug(`Resolved 'owner' as ${this.owner}`);
|
||||
}
|
||||
if (!this.repo) {
|
||||
@@ -317,7 +316,6 @@ class ReleaseNotesBuilder {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
core.setOutput('repo', this.repo);
|
||||
core.debug(`Resolved 'repo' as ${this.repo}`);
|
||||
}
|
||||
core.endGroup();
|
||||
@@ -340,17 +338,7 @@ class ReleaseNotesBuilder {
|
||||
};
|
||||
const mergedPullRequests = prData.mergedPullRequests;
|
||||
const diffInfo = prData.diffInfo;
|
||||
// define the included PRs within this release as output
|
||||
core.setOutput('pull_requests', mergedPullRequests
|
||||
.map(pr => {
|
||||
return pr.number;
|
||||
})
|
||||
.join(','));
|
||||
core.setOutput('changed_files', diffInfo.changedFiles);
|
||||
core.setOutput('additions', diffInfo.additions);
|
||||
core.setOutput('deletions', diffInfo.deletions);
|
||||
core.setOutput('changes', diffInfo.changes);
|
||||
core.setOutput('commits', diffInfo.commits);
|
||||
this.setOutputs(options, diffInfo, mergedPullRequests);
|
||||
const cache = {
|
||||
mergedPullRequests,
|
||||
diffInfo,
|
||||
@@ -394,10 +382,28 @@ class ReleaseNotesBuilder {
|
||||
commitMode: this.commitMode || orgOptions.commitMode,
|
||||
configuration: this.configuration || orgOptions.configuration
|
||||
};
|
||||
this.setOutputs(options, diffInfo, mergedPullRequests);
|
||||
return (0, transform_1.buildChangelog)(diffInfo, mergedPullRequests, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
setOutputs(options, diffInfo, mergedPullRequests) {
|
||||
core.setOutput('owner', options.owner);
|
||||
core.setOutput('repo', options.repo);
|
||||
core.setOutput('toTag', options.toTag.name);
|
||||
core.setOutput('fromTag', options.fromTag.name);
|
||||
// define the included PRs within this release as output
|
||||
core.setOutput('pull_requests', mergedPullRequests
|
||||
.map(pr => {
|
||||
return pr.number;
|
||||
})
|
||||
.join(','));
|
||||
core.setOutput('changed_files', diffInfo.changedFiles);
|
||||
core.setOutput('additions', diffInfo.additions);
|
||||
core.setOutput('deletions', diffInfo.deletions);
|
||||
core.setOutput('changes', diffInfo.changes);
|
||||
core.setOutput('commits', diffInfo.commits);
|
||||
}
|
||||
}
|
||||
exports.ReleaseNotesBuilder = ReleaseNotesBuilder;
|
||||
|
||||
@@ -16915,7 +16921,6 @@ class PullRequestCollector {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
core.setOutput('toTag', thisTag.name);
|
||||
core.debug(`Resolved 'toTag' as ${thisTag.name}`);
|
||||
}
|
||||
let previousTag = tagRange.from;
|
||||
@@ -16923,7 +16928,6 @@ class PullRequestCollector {
|
||||
(0, utils_1.failOrError)(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError);
|
||||
return null;
|
||||
}
|
||||
core.setOutput('fromTag', previousTag.name);
|
||||
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`);
|
||||
if (this.fetchReleaseInformation) {
|
||||
// load release information from the GitHub API
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "pr-collector",
|
||||
"version": "v1.0.2",
|
||||
"version": "v1.0.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pr-collector",
|
||||
"version": "v1.0.2",
|
||||
"version": "v1.0.4",
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pr-collector",
|
||||
"version": "v1.0.3",
|
||||
"version": "v1.0.4",
|
||||
"description": "Library to fetch GitHub pull request between 2 tags/sha1 hashes.",
|
||||
"main": "lib/prCollector.js",
|
||||
"types": "lib/prCollector.d.ts",
|
||||
|
||||
@@ -91,7 +91,6 @@ export class PullRequestCollector {
|
||||
failOrError(`💥 Missing or couldn't resolve 'toTag'`, this.failOnError)
|
||||
return null
|
||||
} else {
|
||||
core.setOutput('toTag', thisTag.name)
|
||||
core.debug(`Resolved 'toTag' as ${thisTag.name}`)
|
||||
}
|
||||
|
||||
@@ -100,7 +99,6 @@ export class PullRequestCollector {
|
||||
failOrError(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError)
|
||||
return null
|
||||
}
|
||||
core.setOutput('fromTag', previousTag.name)
|
||||
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`)
|
||||
|
||||
if (this.fetchReleaseInformation) {
|
||||
|
||||
+27
-18
@@ -1,7 +1,7 @@
|
||||
import * as core from '@actions/core'
|
||||
import {Configuration} from './configuration'
|
||||
import {checkExportedData} from './utils'
|
||||
import {buildChangelog} from './transform'
|
||||
import {PullRequestData, buildChangelog} from './transform'
|
||||
import {PullRequestCollector} from 'github-pr-collector'
|
||||
import {failOrError} from 'github-pr-collector/lib/utils'
|
||||
import {TagInfo} from 'github-pr-collector/lib/tags'
|
||||
@@ -48,6 +48,7 @@ export class ReleaseNotesBuilder {
|
||||
private configuration: Configuration
|
||||
) {}
|
||||
|
||||
|
||||
async build(): Promise<string | null> {
|
||||
const releaseNotesData = checkExportedData()
|
||||
if (releaseNotesData == null) {
|
||||
@@ -55,7 +56,6 @@ export class ReleaseNotesBuilder {
|
||||
failOrError(`💥 Missing or couldn't resolve 'owner'`, this.failOnError)
|
||||
return null
|
||||
} else {
|
||||
core.setOutput('owner', this.owner)
|
||||
core.debug(`Resolved 'owner' as ${this.owner}`)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ export class ReleaseNotesBuilder {
|
||||
failOrError(`💥 Missing or couldn't resolve 'owner'`, this.failOnError)
|
||||
return null
|
||||
} else {
|
||||
core.setOutput('repo', this.repo)
|
||||
core.debug(`Resolved 'repo' as ${this.repo}`)
|
||||
}
|
||||
core.endGroup()
|
||||
@@ -105,21 +104,7 @@ export class ReleaseNotesBuilder {
|
||||
}
|
||||
const mergedPullRequests = prData.mergedPullRequests
|
||||
const diffInfo = prData.diffInfo
|
||||
|
||||
// define the included PRs within this release as output
|
||||
core.setOutput(
|
||||
'pull_requests',
|
||||
mergedPullRequests
|
||||
.map(pr => {
|
||||
return pr.number
|
||||
})
|
||||
.join(',')
|
||||
)
|
||||
core.setOutput('changed_files', diffInfo.changedFiles)
|
||||
core.setOutput('additions', diffInfo.additions)
|
||||
core.setOutput('deletions', diffInfo.deletions)
|
||||
core.setOutput('changes', diffInfo.changes)
|
||||
core.setOutput('commits', diffInfo.commits)
|
||||
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||
|
||||
const cache = {
|
||||
mergedPullRequests,
|
||||
@@ -168,7 +153,31 @@ export class ReleaseNotesBuilder {
|
||||
commitMode: this.commitMode || orgOptions.commitMode,
|
||||
configuration: this.configuration || orgOptions.configuration
|
||||
}
|
||||
|
||||
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||
return buildChangelog(diffInfo, mergedPullRequests, options)
|
||||
}
|
||||
}
|
||||
|
||||
setOutputs(options: ReleaseNotesOptions, diffInfo: DiffInfo, mergedPullRequests: PullRequestData[]): void {
|
||||
core.setOutput('owner', options.owner)
|
||||
core.setOutput('repo', options.repo)
|
||||
core.setOutput('toTag', options.toTag.name)
|
||||
core.setOutput('fromTag', options.fromTag.name)
|
||||
|
||||
// define the included PRs within this release as output
|
||||
core.setOutput(
|
||||
'pull_requests',
|
||||
mergedPullRequests
|
||||
.map(pr => {
|
||||
return pr.number
|
||||
})
|
||||
.join(',')
|
||||
)
|
||||
core.setOutput('changed_files', diffInfo.changedFiles)
|
||||
core.setOutput('additions', diffInfo.additions)
|
||||
core.setOutput('deletions', diffInfo.deletions)
|
||||
core.setOutput('changes', diffInfo.changes)
|
||||
core.setOutput('commits', diffInfo.commits)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user