Skip to content

Commit

Permalink
feat: log on success
Browse files Browse the repository at this point in the history
  • Loading branch information
Timmatt-Lee committed Aug 23, 2020
1 parent a5c73b7 commit 612cc5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1812,8 +1812,8 @@ async function main() {
if (keyWithBracket) {
key = keyWithBracket[0].substring(1, keyWithBracket[0].length - 1);
} else {
if (!isCreateIssue) { process.exit(0); }
if (isOnlyTransition) { throw new Error('Need a valid Jira issue key in your title'); }
if (!isCreateIssue) { core.info('Nothing process'); process.exit(0); }

const userId = await jira.getUserIdByFuzzyName(github.context.actor).catch(core.info);

Expand All @@ -1840,7 +1840,7 @@ async function main() {

await jira.postTransitIssue(key, transition);

if (isOnlyTransition) { process.exit(0); }
if (isOnlyTransition) { core.info('transit completed'); process.exit(0); }

await jira.postComment(key, {
type: 'doc',
Expand Down Expand Up @@ -1872,6 +1872,8 @@ async function main() {
octokit.pulls.update(newPR).then((res) => {
if (res.status !== 200) core.setFailed(JSON.stringify(res));
});

core.info('New issue created');
}

main().catch(core.setFailed);
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ async function main() {
if (keyWithBracket) {
key = keyWithBracket[0].substring(1, keyWithBracket[0].length - 1);
} else {
if (!isCreateIssue) { process.exit(0); }
if (isOnlyTransition) { throw new Error('Need a valid Jira issue key in your title'); }
if (!isCreateIssue) { core.info('Nothing process'); process.exit(0); }

const userId = await jira.getUserIdByFuzzyName(github.context.actor).catch(core.info);

Expand All @@ -76,7 +76,7 @@ async function main() {

await jira.postTransitIssue(key, transition);

if (isOnlyTransition) { process.exit(0); }
if (isOnlyTransition) { core.info('transit completed'); process.exit(0); }

await jira.postComment(key, {
type: 'doc',
Expand Down Expand Up @@ -108,6 +108,8 @@ async function main() {
octokit.pulls.update(newPR).then((res) => {
if (res.status !== 200) core.setFailed(JSON.stringify(res));
});

core.info('New issue created');
}

main().catch(core.setFailed);

0 comments on commit 612cc5f

Please sign in to comment.