Skip to content

Commit

Permalink
API generation script uses correct artifact names (#786)
Browse files Browse the repository at this point in the history
Part of #316 

This PR adds the artifacts for the dev versions of qiskit and
qiskit-ibm-runtime and fixes how we read the JSON file to take into
account the new names of the artifacts.
  • Loading branch information
arnaucasau authored Feb 9, 2024
1 parent d3e39fe commit 13ba5e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scripts/api-html-artifacts.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"qiskit": {
"dev": "https://ibm.box.com/shared/static/eh9tzx3senx5xkq1vvtsr5h697r6j7gk.zip",
"0.46": "https://ibm.box.com/shared/static/74ppfh7b3rx73fntmk9p8pw4asf6pp4a.zip",
"0.45": "https://ibm.box.com/shared/static/e2rwbrztml4dg6lkk1w3e0kmevkw9w7s.zip",
"0.44": "https://ibm.box.com/shared/static/myfk3g20xsp5xj8f3f1fd81p7ywgl7an.zip",
Expand Down Expand Up @@ -30,6 +31,7 @@
"0.9": "https://ibm.box.com/shared/static/wkvhm1z5d61y64hvjxzio7t6974fpwem.zip"
},
"qiskit-ibm-runtime": {
"dev": "https://ibm.box.com/shared/static/wlwpn8n6i6g1er0n6cebejb07hrealb7.zip",
"0.19": "https://ibm.box.com/shared/static/ojpnzc71aex4d8itnktwbp9m7l15nazs.zip",
"0.18": "https://ibm.box.com/shared/static/rbjdfogq8t1a4tquw1bh6gy4qdcv521v.zip",
"0.17": "https://ibm.box.com/shared/static/dnjto1rpvk0qknqb9ir8nr3yv6n0yzhk.zip",
Expand Down
5 changes: 3 additions & 2 deletions scripts/lib/api/apiArtifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ export async function downloadCIArtifact(pkg: Pkg, artifactFolder: string) {
fs.readFileSync(`${getRoot()}/scripts/api-html-artifacts.json`, "utf-8"),
);

if (!(`${pkg.versionWithoutPatch}` in artifactJson[`${pkg.name}`])) {
const artifactName = pkg.isDev() ? "dev" : `${pkg.versionWithoutPatch}`;
if (!(`${artifactName}` in artifactJson[`${pkg.name}`])) {
throw new Error(
`Package ${pkg.name} version ${pkg.versionWithoutPatch} doesn't have an artifact stored. You can add one to https://ibm.ent.box.com/folder/246867452622
following the steps detailed in the \`Generate the API docs\` section on the repo's README. If you are not an IBMer with access to the Box folder,
you can ask in your pull request for a maintainer to help you. In the meantime, you can use another URL in api-html-artifacts.json, such as GitHub or
even localhost for a server you start up; the URL needs to result in downloading the zip file.`,
);
}
const artifactUrl = artifactJson[`${pkg.name}`][`${pkg.versionWithoutPatch}`];
const artifactUrl = artifactJson[`${pkg.name}`][`${artifactName}`];

await downloadFromBox(
pkg.name,
Expand Down

0 comments on commit 13ba5e6

Please sign in to comment.