Skip to content

Commit

Permalink
chore: update debug changelog log.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jan 6, 2021
1 parent 4652302 commit f0f902b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ async function run() {
);
}
let changelog = '';
core.group('Commit Group');
for (const data of commits.data.commits) {
core.info(`Commit Data: \x1b[34m${JSON.stringify(data)}\x1b[0m`);
core.info(`Commit: \x1b[34m${data.commit.message}\x1b[0m \x1b[34m${data.committer.name}\x1b[0m ${data.sha}`);
changelog += formatStringCommit(data.commit.message, `${owner}/${repo}`, {
regExp, shortHash: data.sha.slice(0, 7), filterAuthor, hash: data.sha, author: data.committer.name
});
}
core.endGroup();

let tagRef = '';
if ((github.context.ref || '').startsWith('refs/tags/')) {
Expand All @@ -86,7 +85,9 @@ async function run() {
core.info(`Tag: \x1b[34m${tagRef || '-'}\x1b[0m`);
core.info(`Input head-ref: \x1b[34m${headRef}\x1b[0m`);
core.info(`Input base-ref: \x1b[34m${baseRef}\x1b[0m`);
core.info(`Result Changelog:\n \x1b[34m${changelog}\x1b[0m`);
core.group('Result Changelog');
core.info(`\x1b[34m${changelog}\x1b[0m`);
core.endGroup();
core.setOutput('compareurl', `https://github.com/${owner}/${repo}/compare/${baseRef}...${tagRef || headRef}`);
core.setOutput('changelog', changelog);
} else {
Expand All @@ -103,7 +104,7 @@ async function run() {
}
}

function formatStringCommit(commit = '', repoName = '', { regExp, shortHash, filterAuthor, hash, author }) {
function formatStringCommit(commit = '', repoName = '', { regExp, shortHash, filterAuthor, hash, author = '' }) {
if ((new RegExp(filterAuthor)).test(author) || filterAuthor === false) {
author = '';
}
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ async function run() {
);
}
let changelog = '';
core.group('Commit Group');
for (const data of commits.data.commits) {
core.info(`Commit Data: \x1b[34m${JSON.stringify(data)}\x1b[0m`);
core.info(`Commit: \x1b[34m${data.commit.message}\x1b[0m \x1b[34m${data.committer.name}\x1b[0m ${data.sha}`);
changelog += formatStringCommit(data.commit.message, `${owner}/${repo}`, {
regExp, shortHash: data.sha.slice(0, 7), filterAuthor, hash: data.sha, author: data.committer.name
});
}
core.endGroup();

let tagRef = '';
if ((github.context.ref || '').startsWith('refs/tags/')) {
Expand All @@ -79,7 +78,9 @@ async function run() {
core.info(`Tag: \x1b[34m${tagRef || '-'}\x1b[0m`);
core.info(`Input head-ref: \x1b[34m${headRef}\x1b[0m`);
core.info(`Input base-ref: \x1b[34m${baseRef}\x1b[0m`);
core.info(`Result Changelog:\n \x1b[34m${changelog}\x1b[0m`);
core.group('Result Changelog');
core.info(`\x1b[34m${changelog}\x1b[0m`);
core.endGroup();
core.setOutput('compareurl', `https://github.com/${owner}/${repo}/compare/${baseRef}...${tagRef || headRef}`);
core.setOutput('changelog', changelog);
} else {
Expand All @@ -96,7 +97,7 @@ async function run() {
}
}

function formatStringCommit(commit = '', repoName = '', { regExp, shortHash, filterAuthor, hash, author }) {
function formatStringCommit(commit = '', repoName = '', { regExp, shortHash, filterAuthor, hash, author = '' }) {
if ((new RegExp(filterAuthor)).test(author) || filterAuthor === false) {
author = '';
}
Expand Down

0 comments on commit f0f902b

Please sign in to comment.