From a1961d02212f9bfe6f9f16029e8ea9f59c8cf3b8 Mon Sep 17 00:00:00 2001 From: Enri <81703263+EnricoVacondio@users.noreply.github.com> Date: Sun, 18 Feb 2024 16:28:37 +0100 Subject: [PATCH] Add comment on PRs in CI environments (#1081) * fix: solve github pr comment on ci * chore: format and tests --- lib/plugin/github/GitHub.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/plugin/github/GitHub.js b/lib/plugin/github/GitHub.js index 518a2aac..71b8db90 100644 --- a/lib/plugin/github/GitHub.js +++ b/lib/plugin/github/GitHub.js @@ -127,7 +127,6 @@ class GitHub extends Release { } async release() { - const { assets } = this.options; const { isWeb, isUpdate } = this.getContext(); const { isCI } = this.config; @@ -139,7 +138,11 @@ class GitHub extends Release { return this.step({ task, label: 'Generating link to GitHub Release web interface', prompt: 'release' }); } else if (isCI) { await this.step({ task: () => this[publishMethod](), label: `GitHub ${type} release` }); - return this.step({ enabled: assets, task: () => this.uploadAssets(), label: 'GitHub upload assets' }); + await this.step({ task: () => this.uploadAssets(), label: 'GitHub upload assets' }); + return this.step({ + task: () => (isUpdate ? Promise.resolve() : this.commentOnResolvedItems()), + label: 'GitHub comment on resolved items' + }); } else { const release = async () => { await this[publishMethod](); @@ -373,7 +376,7 @@ class GitHub extends Release { const { owner, project: repo } = this.getContext('repo'); const changelog = await this.getChangelog(); const { comments } = this.options; - const { submit, issue, pr } = comments; + const { submit, issue, pr } = comments ?? {}; const context = this.getContext(); if (!submit || !changelog) return;