Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mcascone committed Aug 16, 2024
1 parent d2c4ac8 commit e3a3180
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
12 changes: 7 additions & 5 deletions actions/example-config-updater/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ function run() {
const mode = core.getInput("mode");
const config = core.getInput("config");
const artifactClient = new artifact_1.DefaultArtifactClient();
const configFileName = "config.json";
const artifactName = "config";
const configFileName = artifactName + ".json";
const rootDir = './';
let artID;
///////// CREATE ///////////////
Expand All @@ -72,7 +72,7 @@ function run() {
}
else {
content = {
max: "cascone",
"keanu": "reeves",
};
}
console.log('content: ', content);
Expand All @@ -84,10 +84,12 @@ function run() {
artID = id !== null && id !== void 0 ? id : 0;
core.setOutput("artifactId", artID);
console.log(`Created artifact with id: ${artID} (bytes: ${size})`);
// set the json string as an env var
core.exportVariable('CONFIG', JSON.stringify(content));
// set artifact id as an output
core.setOutput("artifactId", artID);
// set the json string as an output
core.setOutput('config', JSON.stringify(content));
// set the json string as an env var
core.exportVariable('CONFIG', JSON.stringify(content));
}
///////////// READ ///////////////////
// READ the artifact into a file and create an object
Expand All @@ -98,7 +100,7 @@ function run() {
// parse the file into an object
const downloadResponse = yield artifactClient.downloadArtifact(Number(id));
console.log('downloadResponse: ', downloadResponse);
const file = downloadResponse.downloadPath;
const file = downloadResponse.downloadPath + '/' + configFileName;
console.log('file: ', file);
let data;
// read the file
Expand Down
13 changes: 8 additions & 5 deletions actions/example-config-updater/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export async function run() {
const config = core.getInput("config");

const artifactClient = new DefaultArtifactClient();
const configFileName = "config.json";
const artifactName = "config";
const configFileName = artifactName + ".json";
const rootDir = './';
let artID: number;

Expand All @@ -32,7 +32,7 @@ export async function run() {
}
else {
content = {
max: "cascone",
"keanu": "reeves",
};
}
console.log('content: ', content);
Expand All @@ -47,11 +47,14 @@ export async function run() {
core.setOutput("artifactId", artID);
console.log(`Created artifact with id: ${artID} (bytes: ${size})`);

// set the json string as an env var
core.exportVariable('CONFIG', JSON.stringify(content));
// set artifact id as an output
core.setOutput("artifactId", artID);

// set the json string as an output
core.setOutput('config', JSON.stringify(content));

// set the json string as an env var
core.exportVariable('CONFIG', JSON.stringify(content));
}

///////////// READ ///////////////////
Expand All @@ -66,7 +69,7 @@ export async function run() {
const downloadResponse = await artifactClient.downloadArtifact(Number(id));

console.log('downloadResponse: ', downloadResponse);
const file = downloadResponse.downloadPath;
const file = downloadResponse.downloadPath + '/' + configFileName;
console.log('file: ', file);

let data: string;
Expand Down

0 comments on commit e3a3180

Please sign in to comment.