mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 15:26:23 +07:00 
			
		
		
		
	Fix manifest URL for v1
This commit is contained in:
		| @ -9,7 +9,7 @@ jest.mock('@actions/core', () => ({ | ||||
| })); | ||||
|  | ||||
| jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise<string> => { | ||||
|   return `{ "latest": "8.1", "5.x": "5.6", "url": "${url}" }`; | ||||
|   return `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`; | ||||
| }); | ||||
|  | ||||
| async function cleanup(path: string): Promise<void> { | ||||
| @ -42,12 +42,12 @@ describe('Utils tests', () => { | ||||
|  | ||||
|   it('checking fetch', async () => { | ||||
|     expect(await utils.fetch('test_url')).toBe( | ||||
|       '{ "latest": "8.1", "5.x": "5.6", "url": "test_url" }' | ||||
|       '{ "latest": "8.0", "5.x": "5.6", "url": "test_url" }' | ||||
|     ); | ||||
|   }); | ||||
|  | ||||
|   it('checking parseVersion', async () => { | ||||
|     expect(await utils.parseVersion('latest')).toBe('8.1'); | ||||
|     expect(await utils.parseVersion('latest')).toBe('8.0'); | ||||
|     expect(await utils.parseVersion('7')).toBe('7.0'); | ||||
|     expect(await utils.parseVersion('7.4')).toBe('7.4'); | ||||
|     expect(await utils.parseVersion('5.x')).toBe('5.6'); | ||||
|  | ||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -869,7 +869,7 @@ async function fetch(url) { | ||||
| } | ||||
| exports.fetch = fetch; | ||||
| async function parseVersion(version) { | ||||
|     const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json'; | ||||
|     const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/releases/v1/src/configs/php-versions.json'; | ||||
|     switch (true) { | ||||
|         case /^(latest|\d+\.x)$/.test(version): | ||||
|             return JSON.parse(await fetch(manifest))[version]; | ||||
|  | ||||
| @ -71,7 +71,7 @@ export async function fetch(url: string): Promise<string> { | ||||
|  */ | ||||
| export async function parseVersion(version: string): Promise<string> { | ||||
|   const manifest = | ||||
|     'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json'; | ||||
|     'https://raw.githubusercontent.com/shivammathur/setup-php/releases/v1/src/configs/php-versions.json'; | ||||
|   switch (true) { | ||||
|     case /^(latest|\d+\.x)$/.test(version): | ||||
|       return JSON.parse(await fetch(manifest))[version]; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur