diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 72113f90..cd12b6f0 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -2,7 +2,7 @@ import {upload} from '../src/upload-release-asset' test('Upload Release Asset', async () => { const uploadReleaseAsset = jest.fn().mockReturnValue({ - data: {value: {browser_download_url: 'http://example.com/download'}} + data: {browser_download_url: 'http://example.com/download'} }) const github = { repos: { @@ -33,7 +33,7 @@ test('Upload Release Asset', async () => { test('Upload Multiple Files', async () => { const uploadReleaseAsset = jest.fn().mockReturnValue({ - data: {value: {browser_download_url: 'http://example.com/download'}} + data: {browser_download_url: 'http://example.com/download'} }) const github = { repos: { @@ -84,7 +84,7 @@ test('Upload Multiple Files', async () => { test('Guess Content Types', async () => { const uploadReleaseAsset = jest.fn().mockReturnValue({ - data: {value: {browser_download_url: 'http://example.com/download'}} + data: {browser_download_url: 'http://example.com/download'} }) const github = { repos: { diff --git a/src/main.ts b/src/main.ts index 37add565..b24bf9e3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,7 +10,10 @@ async function run(): Promise { const asset_name = core.getInput('asset_name') const asset_content_type = core.getInput('asset_content_type') - const github = new GitHub(github_token) + // bug? ReposUploadReleaseAssetResponse doesn't match actual response. + // so ignore types + const github = new GitHub(github_token) as any + const output = await upload({ github, upload_url, diff --git a/src/upload-release-asset.ts b/src/upload-release-asset.ts index 943dfd7e..bb5bafad 100644 --- a/src/upload-release-asset.ts +++ b/src/upload-release-asset.ts @@ -21,9 +21,6 @@ interface Response { data: T } interface ReposUploadReleaseAssetResponse { - value: ReposUploadReleaseAssetResponseValue -} -interface ReposUploadReleaseAssetResponseValue { browser_download_url: string } interface GitHubRepos { @@ -67,7 +64,7 @@ export async function upload(opts: Options): Promise { file: fs.readFileSync(file) }) core.debug(JSON.stringify(response)) - return response.data.value.browser_download_url + return response.data.browser_download_url }) ) return {