Skip to content

Commit

Permalink
fix(fetch-engine): download from correct branch [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jun 15, 2020
1 parent b3e999e commit 2c07053
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/packages/fetch-engine/src/getLatestTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { getProxyAgent } from './getProxyAgent'
import { getDownloadUrl } from './util'
import { platforms } from '@prisma/get-platform'
import PQueue from 'p-queue'
import execa from 'execa'

export async function getLatestTag(): Promise<any> {
const url = `https://api.github.com/repos/prisma/prisma-engines/commits`
const branch = await getBranch()
console.log({ branch })
const url = `https://api.github.com/repos/prisma/prisma-engines/commits?sha=${branch}`
const result = await fetch(url, {
agent: getProxyAgent(url),
} as any).then((res) => res.json())
Expand Down Expand Up @@ -38,7 +41,7 @@ export async function getLatestTag(): Promise<any> {
'.sha256',
]) {
const downloadUrl = getDownloadUrl(
'master',
'all_commits',
commit,
platform,
engine,
Expand Down Expand Up @@ -113,3 +116,14 @@ function fromEntries<T>(
}
return result
}

async function getBranch() {
const result = await execa.command(
'git rev-parse --symbolic-full-name --abbrev-ref HEAD',
{
shell: true,
stdio: 'pipe',
},
)
return result.stdout
}

0 comments on commit 2c07053

Please sign in to comment.