Skip to content

Commit

Permalink
fix rewriteAttach
Browse files Browse the repository at this point in the history
  • Loading branch information
volatile-static committed Jun 13, 2024
1 parent b24d46a commit 98fe4ef
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,24 @@ async function rewriteRelease(tag: string, name: string, body: string, prereleas
}

async function rewriteAttach(release: GiteeRelease, file: string) {
const form = new NodeFormData(),
const assets = await client.repositories.getV5ReposOwnerRepoReleasesReleaseIdAttachFiles({
owner,
repo,
releaseId: release.id!,
}),
form = new NodeFormData(),
stream = fs.createReadStream(file);
form.append('file', stream);

for (const asset of release.assets || [])
if ((asset as any).name == path.basename(file))
for (const asset of assets)
if (asset.name == path.basename(file))
await client.repositories
.deleteV5ReposOwnerRepoReleasesReleaseIdAttachFilesAttachFileId({
owner,
repo,
releaseId: release.id!,
attachFileId: (asset as any).id,
attachFileId: asset.id!,
})
.catch(console.error);
form.append('file', stream);
return client.repositories.httpRequest.request({
method: 'POST',
url: '/v5/repos/{owner}/{repo}/releases/{release_id}/attach_files',
Expand Down

0 comments on commit 98fe4ef

Please sign in to comment.