Skip to content

Commit

Permalink
Add comment on PRs in CI environments (#1081)
Browse files Browse the repository at this point in the history
* fix: solve github pr comment on ci

* chore: format and tests
  • Loading branch information
EnricoVacondio committed Feb 18, 2024
1 parent 63a0588 commit a1961d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/plugin/github/GitHub.js
Expand Up @@ -127,7 +127,6 @@ class GitHub extends Release {
}

async release() {
const { assets } = this.options;
const { isWeb, isUpdate } = this.getContext();
const { isCI } = this.config;

Expand All @@ -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]();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a1961d0

Please sign in to comment.