Skip to content

Commit

Permalink
Fix empty descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora Söderlund committed Sep 6, 2023
1 parent 224c3b2 commit 8f87091
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
15 changes: 12 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jira-summary-action",
"version": "0.9.1",
"version": "0.9.2",
"description": "A GitHub Action that posts the summary of a linked Jira story in pull requests.",
"main": "dist/index.js",
"scripts": {
Expand Down
15 changes: 12 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@ import * as adf2md from "adf-to-md";

const octokit = getOctokit(getInput("GITHUB_TOKEN"));

async function getDescription(description: any) {
try {
return adf2md.convert(description).result;
}
catch {
return `*No description available.*`;
}
};

async function execute(storyKey: string) {
console.debug("Getting the story detail from Jira...");

const issueDetails = await getIssueDetails(storyKey);

const description = adf2md.convert(issueDetails.fields.description);
const description = getDescription(issueDetails.fields.description);

if(getInput("JIRA_KEY_MULTIPLE") !== "") {
setOutput("title", issueDetails.fields.summary);
setOutput("description", description.result);
setOutput("description", description);
}

if(context.payload.pull_request) {
Expand Down Expand Up @@ -54,7 +63,7 @@ async function execute(storyKey: string) {
const body = [
`## [${issueDetails.key}](${getInput("JIRA_BASE_URL")}/browse/${issueDetails.key})`,
`### ${issueDetails.fields.summary}`,
description.result
description
].join('\n');

if(existingComment) {
Expand Down

0 comments on commit 8f87091

Please sign in to comment.