Skip to content

Commit

Permalink
delete to overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
mcascone committed Aug 16, 2024
1 parent aecc259 commit 044fd1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions actions/example-config-updater/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ function run() {
const updatedContent = Object.assign(Object.assign({}, content), newContent);
// write the file to the filesystem
fs.writeFileSync(configFileName, JSON.stringify(updatedContent, null, 2));
// core lib doesn't provide an overwrite option, so delete the existing artifact
// and upload the new one
yield artifactClient.deleteArtifact(artifactName);
// upload file 'config.json' as an artifact named 'config'
const files = [configFileName];
const { id, size } = yield artifactClient.uploadArtifact(artifactName, files, rootDir);
Expand Down
4 changes: 4 additions & 0 deletions actions/example-config-updater/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export async function run() {
// write the file to the filesystem
fs.writeFileSync(configFileName, JSON.stringify(updatedContent, null, 2));

// core lib doesn't provide an overwrite option, so delete the existing artifact
// and upload the new one
await artifactClient.deleteArtifact(artifactName);

// upload file 'config.json' as an artifact named 'config'
const files = [configFileName];
const { id, size } = await artifactClient.uploadArtifact(artifactName, files, rootDir);
Expand Down

0 comments on commit 044fd1d

Please sign in to comment.