refactor(conan): retrieve raw content directly from GitHub (#14195)

This commit is contained in:
Jamie Magee 2022-02-12 21:39:15 -08:00 committed by GitHub
parent 8a7abfdf01
commit 766d92144f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 22 deletions

View file

@ -0,0 +1,15 @@
versions:
"1.11.1":
folder: all
"1.11.0":
folder: all
"1.10.1":
folder: all
"1.10.0":
folder: all
"1.9.3":
folder: all
"1.9.4":
folder: all
"1.8.1":
folder: all

View file

@ -1,18 +0,0 @@
{
"name": "config.yml",
"path": "recipes/poco/config.yml",
"sha": "ade8cc1fda69a36ad5a23ad903a4b76223393ca2",
"size": 203,
"url": "https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/poco/config.yml?ref=master",
"html_url": "https://github.com/conan-io/conan-center-index/blob/master/recipes/poco/config.yml",
"git_url": "https://api.github.com/repos/conan-io/conan-center-index/git/blobs/ade8cc1fda69a36ad5a23ad903a4b76223393ca2",
"download_url": "https://raw.githubusercontent.com/conan-io/conan-center-index/master/recipes/poco/config.yml",
"type": "file",
"content": "dmVyc2lvbnM6CiAgIjEuMTEuMSI6CiAgICBmb2xkZXI6IGFsbAogICIxLjEx\nLjAiOgogICAgZm9sZGVyOiBhbGwKICAiMS4xMC4xIjoKICAgIGZvbGRlcjog\nYWxsCiAgIjEuMTAuMCI6CiAgICBmb2xkZXI6IGFsbAogICIxLjkuMyI6CiAg\nICBmb2xkZXI6IGFsbAogICIxLjkuNCI6CiAgICBmb2xkZXI6IGFsbAogICIx\nLjguMSI6CiAgICBmb2xkZXI6IGFsbAo=\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/poco/config.yml?ref=master",
"git": "https://api.github.com/repos/conan-io/conan-center-index/git/blobs/ade8cc1fda69a36ad5a23ad903a4b76223393ca2",
"html": "https://github.com/conan-io/conan-center-index/blob/master/recipes/poco/config.yml"
}
}

View file

@ -7,7 +7,7 @@ import { defaultRegistryUrl } from './common';
import { ConanDatasource } from '.'; import { ConanDatasource } from '.';
const pocoJson = Fixtures.get('poco.json'); const pocoJson = Fixtures.get('poco.json');
const pocoYamlGitHubContent = Fixtures.get('poco.yaml.json'); const pocoYamlGitHubContent = Fixtures.get('poco.yaml');
const malformedJson = Fixtures.get('malformed.json'); const malformedJson = Fixtures.get('malformed.json');
const fakeJson = Fixtures.get('fake.json'); const fakeJson = Fixtures.get('fake.json');
const datasource = ConanDatasource.id; const datasource = ConanDatasource.id;

View file

@ -37,9 +37,10 @@ export class ConanDatasource extends Datasource {
return null; return null;
} }
const url = `https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/${depName}/config.yml`; const url = `https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/${depName}/config.yml`;
const res = await this.githubHttp.getJson<{ content: string }>(url); const res = await this.githubHttp.get(url, {
const content = Buffer.from(res.body.content, 'base64').toString('utf8'); headers: { Accept: 'application/vnd.github.v3.raw' },
const doc = load(content, { });
const doc = load(res.body, {
json: true, json: true,
}) as ConanYAML; }) as ConanYAML;
return { return {