mirror of
				https://github.com/softprops/action-gh-release.git
				synced 2025-10-31 01:30:50 +00:00 
			
		
		
		
	format upload url
This commit is contained in:
		
							parent
							
								
									11282f4ee9
								
							
						
					
					
						commit
						d9cc08588c
					
				
					 4 changed files with 25 additions and 3 deletions
				
			
		|  | @ -4,11 +4,22 @@ import { | |||
|   paths, | ||||
|   parseConfig, | ||||
|   parseInputFiles, | ||||
|   unmatchedPatterns | ||||
|   unmatchedPatterns, | ||||
|   uploadUrl | ||||
| } from "../src/util"; | ||||
| import * as assert from "assert"; | ||||
| 
 | ||||
| describe("util", () => { | ||||
|   describe("uploadUrl", () => { | ||||
|     it("stripts template", () => { | ||||
|       assert.equal( | ||||
|         uploadUrl( | ||||
|           "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}" | ||||
|         ), | ||||
|         "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets" | ||||
|       ); | ||||
|     }); | ||||
|   }); | ||||
|   describe("parseInputFiles", () => { | ||||
|     it("parses empty strings", () => { | ||||
|       assert.deepStrictEqual(parseInputFiles(""), []); | ||||
|  |  | |||
							
								
								
									
										2
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
										
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -144,7 +144,10 @@ export const upload = async ( | |||
|     method: "POST", | ||||
|     body | ||||
|   }); | ||||
|   return resp.json(); | ||||
|   console.log(`resp`, resp); | ||||
|   const json = await resp.json(); | ||||
|   console.log(`body`, json); | ||||
|   return json; | ||||
| 
 | ||||
|   // return await gh.rest.repos.uploadReleaseAsset({
 | ||||
|   //   url,
 | ||||
|  |  | |||
|  | @ -18,6 +18,14 @@ export interface Config { | |||
|   input_target_commitish?: string; | ||||
| } | ||||
| 
 | ||||
| export const uploadUrl = (url: string): string => { | ||||
|   const templateMarkerPos = url.indexOf("{"); | ||||
|   if (templateMarkerPos > -1) { | ||||
|     return url.substring(0, templateMarkerPos); | ||||
|   } | ||||
|   return url; | ||||
| }; | ||||
| 
 | ||||
| export const releaseBody = (config: Config): string | undefined => { | ||||
|   return ( | ||||
|     (config.input_body_path && | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue