Skip to content

Commit

Permalink
Parse issues from commit log instead of changelog (#1071)
Browse files Browse the repository at this point in the history
* Resolve issues from commit log instead of changelog

fix: #1070

* Output exec logs for submitting GitHub comments in dry run mode
  • Loading branch information
northword authored and webpro committed Jan 23, 2024
1 parent 179b734 commit 836f78d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/plugin/github/GitHub.js
Expand Up @@ -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));
Expand All @@ -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}`);
Expand Down

0 comments on commit 836f78d

Please sign in to comment.