From 10d72552097d32df9d2cccc08ae6df1b01489fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E5=87=9B?= Date: Thu, 10 Feb 2022 10:57:22 +0800 Subject: [PATCH] fix: adjust core --- dist/index.js | 21 ++++----------------- src/core/index.ts | 14 ++------------ src/helper/advanced.ts | 4 ++-- src/main.ts | 2 +- 4 files changed, 9 insertions(+), 32 deletions(-) diff --git a/dist/index.js b/dist/index.js index a6d8453..dbef910 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14552,21 +14552,8 @@ const warning = (mess) => { core.warning(`[🎃 AC] ${mess}`); }; exports.warning = warning; -const getInput = (key, options) => { - core.getInput(key, options); -}; -exports.getInput = getInput; -const setOutput = (key, value) => { - let formatValue; - if (typeof (value) === 'object') { - formatValue = JSON.stringify(value); - } - else { - formatValue = value; - } - core.setOutput(key, formatValue); -}; -exports.setOutput = setOutput; +exports.getInput = core.getInput; +exports.setOutput = core.setOutput; const setFailed = (mess) => { core.setFailed(`[🚨 AC] ${mess}`); }; @@ -14812,7 +14799,7 @@ function doFindComments() { if (direction === 'desc') { comments.reverse(); } - core.setOutput('comments', comments); + core.setOutput('comments', JSON.stringify(comments)); core.info(`[doFindComments] comments --> ${JSON.stringify(comments)}`); } else { @@ -14850,7 +14837,7 @@ function doFindIssues() { else { core.info(`[doFindIssues] Query issues empty!`); } - core.setOutput('issues', issues); + core.setOutput('issues', JSON.stringify(issues)); }); } exports.doFindIssues = doFindIssues; diff --git a/src/core/index.ts b/src/core/index.ts index 56db898..5b5b07a 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -20,19 +20,9 @@ export const warning = (mess: string) => { core.warning(`[🎃 AC] ${mess}`); } -export const getInput = (key: string, options?: core.InputOptions): string | void => { - core.getInput(key, options); -} +export const getInput = core.getInput; -export const setOutput = (key: string, value: string | boolean | number | object ) => { - let formatValue: string | number | boolean | object; - if (typeof(value) === 'object') { - formatValue = JSON.stringify(value); - } else { - formatValue = value; - } - core.setOutput(key, formatValue); -} +export const setOutput = core.setOutput; export const setFailed = (mess: string) => { core.setFailed(`[🚨 AC] ${mess}`); diff --git a/src/helper/advanced.ts b/src/helper/advanced.ts index f3717c2..eefe349 100644 --- a/src/helper/advanced.ts +++ b/src/helper/advanced.ts @@ -210,7 +210,7 @@ export async function doFindComments() { if (direction === 'desc') { comments.reverse(); } - core.setOutput('comments', comments); + core.setOutput('comments', JSON.stringify(comments)); core.info(`[doFindComments] comments --> ${JSON.stringify(comments)}`); } else { core.info(`[doFindComments] Query comments empty!`); @@ -244,7 +244,7 @@ export async function doFindIssues() { } else { core.info(`[doFindIssues] Query issues empty!`); } - core.setOutput('issues', issues); + core.setOutput('issues', JSON.stringify(issues)); } export async function doLockIssues(body: string, emoji?: string) { diff --git a/src/main.ts b/src/main.ts index ece1714..588956e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,7 @@ import type { TAction } from './types'; async function main() { try { - const actions = core.getInput('actions', { required: true }) as string; + const actions = core.getInput('actions', { required: true }); console.log(actions) const IHE = new IssueHelperEngine(github.context); for (const action of dealStringToArr(actions)) {