From 61aa0dc2f913e15e51864f95917c31307bbff94a Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 7 Feb 2022 13:10:17 +0530 Subject: [PATCH] Fix manifest URL for v1 --- __tests__/utils.test.ts | 6 +++--- dist/index.js | 2 +- src/utils.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index dbe62e6e..b5b6e7ab 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -9,7 +9,7 @@ jest.mock('@actions/core', () => ({ })); jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise => { - 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 { @@ -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'); diff --git a/dist/index.js b/dist/index.js index 3a11e1d0..04d75e7b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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]; diff --git a/src/utils.ts b/src/utils.ts index a128e017..96df0b66 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -71,7 +71,7 @@ export async function fetch(url: string): Promise { */ export async function parseVersion(version: string): Promise { 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];