diff --git a/src/manifest.ts b/src/manifest.ts index be5c0ed96..10ac85748 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -1219,7 +1219,10 @@ export class Manifest { ); const duplicateReleases: DuplicateReleaseError[] = []; const githubReleases: CreatedRelease[] = []; + let error: unknown | undefined; for (const release of releases) { + // stop releasing once we hit an error + if (error) continue; try { githubReleases.push(await this.createRelease(release)); } catch (err) { @@ -1227,11 +1230,24 @@ export class Manifest { this.logger.warn(`Duplicate release tag: ${release.tag.toString()}`); duplicateReleases.push(err); } else { - throw err; + error = err; } } } + if (githubReleases.length > 0) { + // comment on pull request about the successful releases + const releaseList = githubReleases + .map(({tagName, url}) => `- [${tagName}](${url})`) + .join('\n'); + const comment = `:robot: Created releases:\n${releaseList}\n:sunflower:`; + await this.github.commentOnIssue(comment, pullRequest.number); + } + + if (error) { + throw error; + } + if (duplicateReleases.length > 0) { if ( duplicateReleases.length + githubReleases.length === @@ -1266,10 +1282,6 @@ export class Manifest { prerelease: release.prerelease, }); - // comment on pull request - const comment = `:robot: Release is at ${githubRelease.url} :sunflower:`; - await this.github.commentOnIssue(comment, release.pullRequest.number); - return { ...githubRelease, path: release.path, diff --git a/test/manifest.ts b/test/manifest.ts index bc6c2e6e1..7315dee0c 100644 --- a/test/manifest.ts +++ b/test/manifest.ts @@ -5722,7 +5722,7 @@ describe('Manifest', () => { expect(releases[3]!.sha).to.eql('abc123'); expect(releases[3]!.notes).to.be.string; expect(releases[3]!.path).to.eql('packages/datastore-lock'); - sinon.assert.callCount(commentStub, 4); + sinon.assert.callCount(commentStub, 1); sinon.assert.calledOnceWithExactly( addLabelsStub, ['autorelease: tagged'], @@ -6200,7 +6200,7 @@ describe('Manifest', () => { expect(releases[2]!.sha).to.eql('abc123'); expect(releases[2]!.notes).to.be.string; expect(releases[2]!.path).to.eql('packages/datastore-lock'); - sinon.assert.callCount(commentStub, 3); + sinon.assert.callCount(commentStub, 1); sinon.assert.calledOnceWithExactly( addLabelsStub, ['autorelease: tagged'],