Skip to content

Commit

Permalink
fix: output if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
cakeinpanic committed Sep 7, 2023
1 parent 509f5b2 commit 184cd08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { JiraConnector } from './jira-connector';

async function run(): Promise<void> {
const { FAIL_WHEN_JIRA_ISSUE_NOT_FOUND } = getInputs();
let jiraIssueFound = false;
let jiraIssueSource = null;

try {
const { BRANCH_IGNORE_PATTERN } = getInputs();
Expand All @@ -29,21 +27,21 @@ async function run(): Promise<void> {
const details = await jiraConnector.getTicketDetails(key);
await githubConnector.updatePrDetails(details);

jiraIssueFound = true;
jiraIssueSource = source;
core.setOutput('jira-issue-found', true);
core.setOutput('jira-issue-source', source);
} catch (error) {
console.log('Failed to add JIRA description to PR.');
core.error(error.message);

core.setOutput('jira-issue-found', false);
core.setOutput('jira-issue-source', 'null');

if (FAIL_WHEN_JIRA_ISSUE_NOT_FOUND) {
core.setFailed(error.message);
process.exit(1);
} else {
process.exit(0);
}
} finally {
core.setOutput('jira-issue-found', jiraIssueFound.toString());
core.setOutput('jira-issue-source', jiraIssueSource);
}
}

Expand Down

0 comments on commit 184cd08

Please sign in to comment.