webdriverio/scripts/utils/index.ts
Christian Bromann a2ae35332f
chore: upgrade to Eslint v9 (#13867)
* chore: upgrade to Eslint v9

* fix remaining issues

* more type fixes

* resolve remaining issues

* use wdio eslint package

* PR feedback
2024-12-18 11:55:43 -08:00

16 lines
661 B
TypeScript

const githubReadme = '/README.md'
const githubHost = 'https://github.com/'
const githubRawHost = 'https://raw.githubusercontent.com/'
/**
* Download README.md from github
* @param {string} githubUrl github url to project
* @param {string} location file location in repo
* @return {Promise<string>} readme content
*/
export async function downloadFromGitHub(githubUrl: string, branch: string, location = githubReadme) {
const url = `${githubUrl}/${branch}/${location}`.replace(githubHost, githubRawHost)
console.log(`Downloading: ${url}`)
const res = await fetch(url)
return await res.text()
}