diff --git a/action.yml b/action.yml index f936067..92c5e76 100644 --- a/action.yml +++ b/action.yml @@ -10,11 +10,7 @@ inputs: key_secret: description: 'The key secret for authentication' required: true - inputs: - description: 'The inputs from meshstStack buildingblock' - required: false - default: '[]' -outputs: + outputs: token_file: description: 'Path to the file containing the authentication token' runs: diff --git a/dist/index.js b/dist/index.js index 9039afa..5017ea9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -44,11 +44,9 @@ async function run() { const stepsInput = core.getInput('steps'); const clientId = core.getInput('client_id'); const keySecret = core.getInput('key_secret'); - const inputs = JSON.parse(core.getInput('inputs')); core.debug(`Steps Input: ${stepsInput}`); core.debug(`Client ID: ${clientId}`); core.debug(`Key Secret: ${keySecret}`); - core.debug(`Inputs: ${JSON.stringify(inputs)}`); // Extract buildingBlockRun from the GitHub event payload const buildingBlockRun = github.context.payload.inputs.buildingBlockRun; core.debug(`Building Block Run: ${buildingBlockRun}`); @@ -57,6 +55,7 @@ async function run() { const buildingBlockRunJson = JSON.parse(decodedBuildingBlockRun); const bbRunUuid = buildingBlockRunJson.metadata.uuid; const baseUrl = buildingBlockRunJson._links.meshstackBaseUrl.href; + const inputs = buildingBlockRunJson.spec.buildingBlock.spec.inputs; core.debug(`Base URL: ${baseUrl}`); core.debug(`BB Run UUID: ${bbRunUuid}`); // Extract additional inputs @@ -66,11 +65,13 @@ async function run() { const value = (_a = buildingBlockRunJson.spec.buildingBlock.spec.inputs.find((i) => i.key === input.key)) === null || _a === void 0 ? void 0 : _a.value; if (value) { extractedInputs[input.key] = value; - // Write each extracted input to GITHUB_OUTPUT - core.setOutput(input.key, value); } }); core.debug(`Extracted Inputs: ${JSON.stringify(extractedInputs)}`); + // Write each extracted input to GITHUB_OUTPUT + for (const [key, value] of Object.entries(extractedInputs)) { + core.setOutput(key, value); + } // Decode and parse the steps input const decodedStepsInput = decodeURIComponent(stepsInput); const steps = JSON.parse(decodedStepsInput); diff --git a/src/index.ts b/src/index.ts index bcb6095..9b6129c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,12 +10,10 @@ async function run() { const stepsInput = core.getInput('steps'); const clientId = core.getInput('client_id'); const keySecret = core.getInput('key_secret'); - const inputs = JSON.parse(core.getInput('inputs')); core.debug(`Steps Input: ${stepsInput}`); core.debug(`Client ID: ${clientId}`); core.debug(`Key Secret: ${keySecret}`); - core.debug(`Inputs: ${JSON.stringify(inputs)}`); // Extract buildingBlockRun from the GitHub event payload const buildingBlockRun = github.context.payload.inputs.buildingBlockRun; @@ -26,6 +24,7 @@ async function run() { const buildingBlockRunJson = JSON.parse(decodedBuildingBlockRun); const bbRunUuid = buildingBlockRunJson.metadata.uuid; const baseUrl = buildingBlockRunJson._links.meshstackBaseUrl.href; + const inputs = buildingBlockRunJson.spec.buildingBlock.spec.inputs; core.debug(`Base URL: ${baseUrl}`); core.debug(`BB Run UUID: ${bbRunUuid}`); @@ -36,13 +35,16 @@ async function run() { const value = buildingBlockRunJson.spec.buildingBlock.spec.inputs.find((i: { key: string }) => i.key === input.key)?.value; if (value) { extractedInputs[input.key] = value; - // Write each extracted input to GITHUB_OUTPUT - core.setOutput(input.key, value); } }); core.debug(`Extracted Inputs: ${JSON.stringify(extractedInputs)}`); + // Write each extracted input to GITHUB_OUTPUT + for (const [key, value] of Object.entries(extractedInputs)) { + core.setOutput(key, value); + } + // Decode and parse the steps input const decodedStepsInput = decodeURIComponent(stepsInput); const steps = JSON.parse(decodedStepsInput); @@ -150,4 +152,3 @@ async function run() { } run(); -