From 65a502e85c567daffb186655559c847d9b0f91d0 Mon Sep 17 00:00:00 2001 From: Akkuman Date: Mon, 23 Jun 2025 15:10:15 +0800 Subject: [PATCH] fix: delete old release attachments --- dist/index.js | 4 ++++ main.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dist/index.js b/dist/index.js index 30ed973..f046a5f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -48278,6 +48278,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { repo: repo, id: release_id, }) + // deleted old release attachment for (const filepath of all_files) { for (const attachment of attachments) { let will_deleted = [external_path_.basename(filepath), `${external_path_.basename(filepath)}.md5`, `${external_path_.basename(filepath)}.sha256`] @@ -48291,6 +48292,9 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { console.log(`Successfully deleted old release attachment ${attachment.name}`) } } + } + // upload new release attachment + for (const filepath of all_files) { const content = external_fs_.readFileSync(filepath); let blob = new external_buffer_.Blob([content]); await client.repository.repoCreateReleaseAttachment({ diff --git a/main.js b/main.js index 95865e2..e9987b3 100644 --- a/main.js +++ b/main.js @@ -142,6 +142,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { repo: repo, id: release_id, }) + // deleted old release attachment for (const filepath of all_files) { for (const attachment of attachments) { let will_deleted = [path.basename(filepath), `${path.basename(filepath)}.md5`, `${path.basename(filepath)}.sha256`] @@ -155,6 +156,9 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { console.log(`Successfully deleted old release attachment ${attachment.name}`) } } + } + // upload new release attachment + for (const filepath of all_files) { const content = fs.readFileSync(filepath); let blob = new Blob([content]); await client.repository.repoCreateReleaseAttachment({