Skip to content

Commit

Permalink
Remove stale assets
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Mar 24, 2023
1 parent 273ca2f commit ccab9b0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/actions/github-release/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,20 @@ async function runOnce() {
}
console.log("found release: ", JSON.stringify(release.data, null, 2));

// Delete all assets from a previous run
for (const asset of release.data.assets) {
console.log(`deleting prior asset ${asset.id}`);
await octokit.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id: asset.id,
});
}

// Upload all the relevant assets for this release as just general blobs.
for (const file of glob.sync(files)) {
const size = fs.statSync(file).size;
const name = path.basename(file);
for (const asset of release.data.assets) {
if (asset.name !== name)
continue;
console.log(`deleting prior asset ${asset.id}`);
await octokit.rest.repos.deleteReleaseAsset({
owner,
repo,
asset_id: asset.id,
});
}
core.info(`upload ${file}`);
await octokit.rest.repos.uploadReleaseAsset({
data: fs.createReadStream(file),
Expand Down

0 comments on commit ccab9b0

Please sign in to comment.