Skip to content

Commit

Permalink
feat: add show-emoji input. (fix #110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 14, 2023
1 parent 8c8e8de commit 3497bc7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Only use the following Git Commit Messages. A simple and small footprint is crit
- `original-markdown` Default `true`, Output clean markdown content.
- `gh-pages` Default `gh-pages`, Specify the branch name to get the hash from
- `path` Only commits containing this file path will be returned.
- `show-emoji` Show emoji icons. Default `true`.

## Outputs

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ inputs:
description: 'Output clean markdown content.'
default: 'true'
required: false
show-emoji:
description: 'Show emoji icons.'
default: 'true'
required: false
path:
description: 'Only commits containing this file path will be returned..'
default: ''
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function run() {
var baseRef = getInput('base-ref');
const myToken = getInput('token');
const myPath = getInput('path');
const showEmoji = getInput('show-emoji') === 'false' ? false : true;
const filterAuthor = getInput('filter-author');
const regExp = getInput('filter');
const ghPagesBranch = getInput('gh-pages') || 'gh-pages';
Expand Down Expand Up @@ -170,11 +171,11 @@ async function run() {
commitLog = commitLog.map((commit) => {
(Object.keys(types) as Array<keyof typeof types>).forEach((name) => {
if (getRegExp(name, commit)) {
commit = `- ${types[name]} ${commit}`;
commit = showEmoji ? `- ${types[name]} ${commit}` : `- ${commit}`;
}
});
if (!/^-\s/.test(commit) && commit) {
commit = `- 📄 ${commit}`;
commit = showEmoji ? `- 📄 ${commit}` : `- ${commit}`;
}
return commit
}).filter(Boolean);
Expand Down

0 comments on commit 3497bc7

Please sign in to comment.