diff --git a/lib/plugin/github/GitHub.js b/lib/plugin/github/GitHub.js index 0bfe046d..17548a6e 100644 --- a/lib/plugin/github/GitHub.js +++ b/lib/plugin/github/GitHub.js @@ -371,12 +371,12 @@ class GitHub extends Release { async commentOnResolvedItems() { const { isDryRun } = this.config; const { owner, project: repo } = this.getContext('repo'); - const { changelog } = this.config.getContext(); + const changelog = await this.getChangelog(); const { comments } = this.options; const { submit, issue, pr } = comments; const context = this.getContext(); - if (!submit || !changelog || isDryRun) return; + if (!submit || !changelog) return; const shas = getCommitsFromChangelog(changelog); const searchResults = await Promise.all(searchQueries(this.client, owner, repo, shas)); @@ -390,6 +390,11 @@ class GitHub extends Release { const comment = format(format(type === 'pr' ? pr : issue, context), context); const url = `${host}/${owner}/${repo}/${type === 'pr' ? 'pull' : 'issues'}/${number}`; + if (isDryRun) { + this.log.exec(`octokit issues.createComment (${url})`, { isDryRun }); + return; + } + try { await this.client.issues.createComment({ owner, repo, issue_number: number, body: comment }); this.log.log(`● Commented on ${url}`);