Skip to content

Commit

Permalink
adding vars also to action
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Nov 7, 2024
1 parent 2306754 commit 512057e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 1 addition & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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
Expand All @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}`);
Expand All @@ -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);
Expand Down Expand Up @@ -150,4 +152,3 @@ async function run() {
}

run();

0 comments on commit 512057e

Please sign in to comment.