- improve setting the outputs when loading the pr data from the cache
This commit is contained in:
+19
-15
@@ -309,7 +309,6 @@ class ReleaseNotesBuilder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.setOutput('owner', this.owner);
|
|
||||||
core.debug(`Resolved 'owner' as ${this.owner}`);
|
core.debug(`Resolved 'owner' as ${this.owner}`);
|
||||||
}
|
}
|
||||||
if (!this.repo) {
|
if (!this.repo) {
|
||||||
@@ -317,7 +316,6 @@ class ReleaseNotesBuilder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.setOutput('repo', this.repo);
|
|
||||||
core.debug(`Resolved 'repo' as ${this.repo}`);
|
core.debug(`Resolved 'repo' as ${this.repo}`);
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
@@ -340,17 +338,7 @@ class ReleaseNotesBuilder {
|
|||||||
};
|
};
|
||||||
const mergedPullRequests = prData.mergedPullRequests;
|
const mergedPullRequests = prData.mergedPullRequests;
|
||||||
const diffInfo = prData.diffInfo;
|
const diffInfo = prData.diffInfo;
|
||||||
// define the included PRs within this release as output
|
this.setOutputs(options, diffInfo, mergedPullRequests);
|
||||||
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);
|
|
||||||
const cache = {
|
const cache = {
|
||||||
mergedPullRequests,
|
mergedPullRequests,
|
||||||
diffInfo,
|
diffInfo,
|
||||||
@@ -394,10 +382,28 @@ class ReleaseNotesBuilder {
|
|||||||
commitMode: this.commitMode || orgOptions.commitMode,
|
commitMode: this.commitMode || orgOptions.commitMode,
|
||||||
configuration: this.configuration || orgOptions.configuration
|
configuration: this.configuration || orgOptions.configuration
|
||||||
};
|
};
|
||||||
|
this.setOutputs(options, diffInfo, mergedPullRequests);
|
||||||
return (0, transform_1.buildChangelog)(diffInfo, mergedPullRequests, options);
|
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;
|
exports.ReleaseNotesBuilder = ReleaseNotesBuilder;
|
||||||
|
|
||||||
@@ -16915,7 +16921,6 @@ class PullRequestCollector {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.setOutput('toTag', thisTag.name);
|
|
||||||
core.debug(`Resolved 'toTag' as ${thisTag.name}`);
|
core.debug(`Resolved 'toTag' as ${thisTag.name}`);
|
||||||
}
|
}
|
||||||
let previousTag = tagRange.from;
|
let previousTag = tagRange.from;
|
||||||
@@ -16923,7 +16928,6 @@ class PullRequestCollector {
|
|||||||
(0, utils_1.failOrError)(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError);
|
(0, utils_1.failOrError)(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
core.setOutput('fromTag', previousTag.name);
|
|
||||||
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`);
|
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`);
|
||||||
if (this.fetchReleaseInformation) {
|
if (this.fetchReleaseInformation) {
|
||||||
// load release information from the GitHub API
|
// 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",
|
"name": "pr-collector",
|
||||||
"version": "v1.0.2",
|
"version": "v1.0.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pr-collector",
|
"name": "pr-collector",
|
||||||
"version": "v1.0.2",
|
"version": "v1.0.4",
|
||||||
"license": "Apache 2.0",
|
"license": "Apache 2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pr-collector",
|
"name": "pr-collector",
|
||||||
"version": "v1.0.3",
|
"version": "v1.0.4",
|
||||||
"description": "Library to fetch GitHub pull request between 2 tags/sha1 hashes.",
|
"description": "Library to fetch GitHub pull request between 2 tags/sha1 hashes.",
|
||||||
"main": "lib/prCollector.js",
|
"main": "lib/prCollector.js",
|
||||||
"types": "lib/prCollector.d.ts",
|
"types": "lib/prCollector.d.ts",
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ export class PullRequestCollector {
|
|||||||
failOrError(`💥 Missing or couldn't resolve 'toTag'`, this.failOnError)
|
failOrError(`💥 Missing or couldn't resolve 'toTag'`, this.failOnError)
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
core.setOutput('toTag', thisTag.name)
|
|
||||||
core.debug(`Resolved 'toTag' as ${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)
|
failOrError(`💥 Unable to retrieve previous tag given ${this.toTag}`, this.failOnError)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
core.setOutput('fromTag', previousTag.name)
|
|
||||||
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`)
|
core.debug(`fromTag resolved via previousTag as: ${previousTag.name}`)
|
||||||
|
|
||||||
if (this.fetchReleaseInformation) {
|
if (this.fetchReleaseInformation) {
|
||||||
|
|||||||
+27
-18
@@ -1,7 +1,7 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {Configuration} from './configuration'
|
import {Configuration} from './configuration'
|
||||||
import {checkExportedData} from './utils'
|
import {checkExportedData} from './utils'
|
||||||
import {buildChangelog} from './transform'
|
import {PullRequestData, buildChangelog} from './transform'
|
||||||
import {PullRequestCollector} from 'github-pr-collector'
|
import {PullRequestCollector} from 'github-pr-collector'
|
||||||
import {failOrError} from 'github-pr-collector/lib/utils'
|
import {failOrError} from 'github-pr-collector/lib/utils'
|
||||||
import {TagInfo} from 'github-pr-collector/lib/tags'
|
import {TagInfo} from 'github-pr-collector/lib/tags'
|
||||||
@@ -48,6 +48,7 @@ export class ReleaseNotesBuilder {
|
|||||||
private configuration: Configuration
|
private configuration: Configuration
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
async build(): Promise<string | null> {
|
async build(): Promise<string | null> {
|
||||||
const releaseNotesData = checkExportedData()
|
const releaseNotesData = checkExportedData()
|
||||||
if (releaseNotesData == null) {
|
if (releaseNotesData == null) {
|
||||||
@@ -55,7 +56,6 @@ export class ReleaseNotesBuilder {
|
|||||||
failOrError(`💥 Missing or couldn't resolve 'owner'`, this.failOnError)
|
failOrError(`💥 Missing or couldn't resolve 'owner'`, this.failOnError)
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
core.setOutput('owner', this.owner)
|
|
||||||
core.debug(`Resolved 'owner' as ${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)
|
failOrError(`💥 Missing or couldn't resolve 'owner'`, this.failOnError)
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
core.setOutput('repo', this.repo)
|
|
||||||
core.debug(`Resolved 'repo' as ${this.repo}`)
|
core.debug(`Resolved 'repo' as ${this.repo}`)
|
||||||
}
|
}
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
@@ -105,21 +104,7 @@ export class ReleaseNotesBuilder {
|
|||||||
}
|
}
|
||||||
const mergedPullRequests = prData.mergedPullRequests
|
const mergedPullRequests = prData.mergedPullRequests
|
||||||
const diffInfo = prData.diffInfo
|
const diffInfo = prData.diffInfo
|
||||||
|
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||||
// 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)
|
|
||||||
|
|
||||||
const cache = {
|
const cache = {
|
||||||
mergedPullRequests,
|
mergedPullRequests,
|
||||||
@@ -168,7 +153,31 @@ export class ReleaseNotesBuilder {
|
|||||||
commitMode: this.commitMode || orgOptions.commitMode,
|
commitMode: this.commitMode || orgOptions.commitMode,
|
||||||
configuration: this.configuration || orgOptions.configuration
|
configuration: this.configuration || orgOptions.configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setOutputs(options, diffInfo, mergedPullRequests)
|
||||||
return buildChangelog(diffInfo, mergedPullRequests, options)
|
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