-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (23 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const core = require('@actions/core');
const exec = require('@actions/exec');
async function run() {
try {
const commitMessage = core.getInput('commit_message');
const format = core.getInput('format');
const preset = core.getInput('preset');
const groupSimilarCommits = core.getBooleanInput('group_similar_commits');
const addAuthor = core.getBooleanInput('add_author');
const authorEmail = core.getInput('author_email');
const authorName = core.getInput('author_name');
await exec.exec('npm i -g gitmoji-changelog@2.3.0 --silent');
await exec.exec(`gitmoji-changelog --format "${format}" --preset "${preset}" ${groupSimilarCommits ? "--group-similar-commits true" : ""} ${addAuthor ? "--author true" : ""}`);
await exec.exec(`git add .`);
await exec.exec(`git config --global user.email "${authorEmail}"`);
await exec.exec(`git config --global user.name "${authorName}"`);
await exec.exec(`git commit -m "${commitMessage}"`);
await exec.exec(`git push`);
} catch (error) {
core.setFailed(error.message);
}
}
run();