You've already forked gitea-release-action
							
							
				mirror of
				https://gitea.com/actions/gitea-release-action.git
				synced 2025-10-31 06:46:20 +07:00 
			
		
		
		
	fix: delete old release attachments
This commit is contained in:
		
							
								
								
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -48278,6 +48278,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { | |||||||
|     repo: repo, |     repo: repo, | ||||||
|     id: release_id, |     id: release_id, | ||||||
|   }) |   }) | ||||||
|  |   // deleted old release attachment
 | ||||||
|   for (const filepath of all_files) { |   for (const filepath of all_files) { | ||||||
|     for (const attachment of attachments) { |     for (const attachment of attachments) { | ||||||
|       let will_deleted = [external_path_.basename(filepath), `${external_path_.basename(filepath)}.md5`, `${external_path_.basename(filepath)}.sha256`] |       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}`) |         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); |     const content = external_fs_.readFileSync(filepath); | ||||||
|     let blob = new external_buffer_.Blob([content]); |     let blob = new external_buffer_.Blob([content]); | ||||||
|     await client.repository.repoCreateReleaseAttachment({ |     await client.repository.repoCreateReleaseAttachment({ | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.js
									
									
									
									
									
								
							| @ -142,6 +142,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { | |||||||
|     repo: repo, |     repo: repo, | ||||||
|     id: release_id, |     id: release_id, | ||||||
|   }) |   }) | ||||||
|  |   // deleted old release attachment | ||||||
|   for (const filepath of all_files) { |   for (const filepath of all_files) { | ||||||
|     for (const attachment of attachments) { |     for (const attachment of attachments) { | ||||||
|       let will_deleted = [path.basename(filepath), `${path.basename(filepath)}.md5`, `${path.basename(filepath)}.sha256`] |       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}`) |         console.log(`Successfully deleted old release attachment ${attachment.name}`) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |   // upload new release attachment | ||||||
|  |   for (const filepath of all_files) { | ||||||
|     const content = fs.readFileSync(filepath); |     const content = fs.readFileSync(filepath); | ||||||
|     let blob = new Blob([content]); |     let blob = new Blob([content]); | ||||||
|     await client.repository.repoCreateReleaseAttachment({ |     await client.repository.repoCreateReleaseAttachment({ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Akkuman
					Akkuman