Skip to content

Commit

Permalink
Merge pull request #2 from apitable/fix/commit-author-is-null
Browse files Browse the repository at this point in the history
fix: fix the problem when commit author is null
  • Loading branch information
mr-kelly authored Aug 10, 2023
2 parents cd316be + edee891 commit 8402f14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ interface ICommit {
login: string;
};
commit: {
author: {
name: string;
}
message: string;
};
}

function parseCommit(commit: ICommit) {
const username = commit.author.login;
const username = commit.author ? `@${commit.author.login}` : commit.commit.author.name;
const message = commit.commit.message.split(/\r?\n/)[0];
return { username, message };
}
Expand All @@ -76,7 +79,7 @@ function getLineFromCommit(owner: string, repo: string, commit: ICommit) {
}
}

const mdUsername = `@${username}`;
const mdUsername = `${username}`;

return `* ${mdMessage} ${mdUsername} \n`;
}
Expand Down

0 comments on commit 8402f14

Please sign in to comment.