Use assets browser download url if it exists over archive tag name

This commit is contained in:
Lourens Schep 2022-03-30 09:54:32 -03:00
parent b52935229e
commit 8dc7bfbb85
1 changed files with 14 additions and 5 deletions

View File

@ -77,11 +77,20 @@ const getLatestReleaseZipUrl = async (
} }
} ); } );
} else if ( authorizationToken ) { } else if ( authorizationToken ) {
// If it's a private repo, we need to download the archive this way // If it's a private repo, we need to download the archive this way.
// Use uploaded assets over downloading the zip archive.
if (
body.assets &&
body.assets.length > 0 &&
body.assets[ 0 ].browser_download_url
) {
resolve( body.assets[ 0 ].browser_download_url );
} else {
const tagName = body.tag_name; const tagName = body.tag_name;
resolve( resolve(
`https://github.com/${ repository }/archive/${ tagName }.zip` `https://github.com/${ repository }/archive/${ tagName }.zip`
); );
}
} else { } else {
resolve( body.assets[ 0 ].browser_download_url ); resolve( body.assets[ 0 ].browser_download_url );
} }