From 0587d01416caff6954603556a0b655c6b98d8d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nora=20S=C3=B6derlund?= Date: Tue, 5 Sep 2023 22:16:35 +0200 Subject: [PATCH] Fix optional inputs --- action.yml | 3 --- dist/index.js | 8 ++++---- dist/index.js.map | 2 +- package.json | 2 +- src/index.ts | 8 ++++---- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index f417d2b..53b38ae 100644 --- a/action.yml +++ b/action.yml @@ -28,15 +28,12 @@ inputs: JIRA_KEY_MULTIPLE: description: If true and JIRA_KEY is a project key, post a comment for every story key found. - default: false JIRA_PARTIAL_KEY_SILENT_FAILURE: description: If true, not finding a story key in a pull request if a project key is specified, only throws a silent error. - default: false DISABLE_PULL_REQUEST_COMMENT: description: If true, using the action will not create or update a pull request comment. Useful for only fetching the issue details from the output. - default: false outputs: title: diff --git a/dist/index.js b/dist/index.js index 0c05fa1..1c5d78c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36,12 +36,12 @@ async function execute(storyKey) { console.debug("Getting the story detail from Jira..."); const issueDetails = await (0, getIssueDetails_1.default)(storyKey); const description = adf2md.convert(issueDetails.fields.description); - if (!(0, core_1.getInput)("JIRA_KEY_MULTIPLE")) { + if ((0, core_1.getInput)("JIRA_KEY_MULTIPLE") !== "") { (0, core_1.setOutput)("title", issueDetails.fields.summary); (0, core_1.setOutput)("description", description.result); } if (github_1.context.payload.pull_request) { - if ((0, core_1.getInput)("DISABLE_PULL_REQUEST_COMMENT")) { + if ((0, core_1.getInput)("DISABLE_PULL_REQUEST_COMMENT") !== "") { console.info("Not creating or update any comments because DISABLE_PULL_REQUEST_COMMENT is true."); return; } @@ -114,7 +114,7 @@ async function init() { } } if (!storyKeys.length) { - if ((0, core_1.getInput)("JIRA_PARTIAL_KEY_SILENT_FAILURE")) { + if ((0, core_1.getInput)("JIRA_PARTIAL_KEY_SILENT_FAILURE") !== "") { console.error("Failed to find a Jira key starting with " + jiraKey); console.info("Executing silent error because JIRA_PARTIAL_KEY_SILENT_FAILURE is true."); } @@ -122,7 +122,7 @@ async function init() { (0, core_1.setFailed)("Failed to find a Jira key starting with " + jiraKey); return; } - if ((0, core_1.getInput)("JIRA_KEY_MULTIPLE")) { + if ((0, core_1.getInput)("JIRA_KEY_MULTIPLE") !== "") { for (let storyKey of storyKeys) execute(storyKey); } diff --git a/dist/index.js.map b/dist/index.js.map index 2231b30..5517c05 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA+D;AAC/D,4CAAsD;AACtD,2FAAmE;AAEnE,kBAAkB;AAClB,kDAAoC;AAEpC,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,IAAA,eAAQ,EAAC,cAAc,CAAC,CAAC,CAAC;AAErD,KAAK,UAAU,OAAO,CAAC,QAAgB;IACrC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAEvD,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAe,EAAC,QAAQ,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEpE,IAAG,CAAC,IAAA,eAAQ,EAAC,mBAAmB,CAAC,EAAE;QACjC,IAAA,gBAAS,EAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChD,IAAA,gBAAS,EAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KAC9C;IAED,IAAG,gBAAO,CAAC,OAAO,CAAC,YAAY,EAAE;QAC/B,IAAG,IAAA,eAAQ,EAAC,8BAA8B,CAAC,EAAE;YAC3C,OAAO,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAC;YAElG,OAAO;SACR;QAED,OAAO,CAAC,KAAK,C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AAC,CAAC,CAAC,CAAC,CAAC;KACzB;;QAEC,OAAO,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAAA,CAAC;AAEF,IAAI;IACF,IAAI,EAAE,CAAC;CACR;AACD,OAAM,KAAK,EAAE;IACX,IAAG,KAAK,YAAY,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QACpD,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC;;QAEjB,IAAA,gBAAS,EAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;CACxC"} \ No newline at end of file diff --git a/package.json b/package.json index 29fbaba..1043050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jira-summary-action", - "version": "0.9.0", + "version": "0.9.1", "description": "A GitHub Action that posts the summary of a linked Jira story in pull requests.", "main": "dist/index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index 48e5cae..d25c9d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,13 +14,13 @@ async function execute(storyKey: string) { const description = adf2md.convert(issueDetails.fields.description); - if(!getInput("JIRA_KEY_MULTIPLE")) { + if(getInput("JIRA_KEY_MULTIPLE") !== "") { setOutput("title", issueDetails.fields.summary); setOutput("description", description.result); } if(context.payload.pull_request) { - if(getInput("DISABLE_PULL_REQUEST_COMMENT")) { + if(getInput("DISABLE_PULL_REQUEST_COMMENT") !== "") { console.info("Not creating or update any comments because DISABLE_PULL_REQUEST_COMMENT is true."); return; @@ -117,7 +117,7 @@ async function init() { } if(!storyKeys.length) { - if(getInput("JIRA_PARTIAL_KEY_SILENT_FAILURE")) { + if(getInput("JIRA_PARTIAL_KEY_SILENT_FAILURE") !== "") { console.error("Failed to find a Jira key starting with " + jiraKey); console.info("Executing silent error because JIRA_PARTIAL_KEY_SILENT_FAILURE is true."); @@ -128,7 +128,7 @@ async function init() { return; } - if(getInput("JIRA_KEY_MULTIPLE")) { + if(getInput("JIRA_KEY_MULTIPLE") !== "") { for(let storyKey of storyKeys) execute(storyKey); }