Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic for checking historical Qiskit docs #889

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions scripts/commands/checkLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,11 @@ async function determineCurrentDocsFileBatch(
"!docs/api/qiskit/release-notes/*",
];
const toLoad = [
// The 0.46 docs are used by migration guides.
"docs/api/qiskit/0.46/*.md",
// These docs are used by the migration guides.
"docs/api/qiskit/0.46/{algorithms,opflow,execute}.md",
"docs/api/qiskit/0.46/qiskit.{algorithms,extensions,opflow}.*",
"docs/api/qiskit/0.46/qiskit.utils.QuantumInstance.md",
"docs/api/qiskit/0.46/qiskit.primitives.Base{Estimator,Sampler}.md",
"docs/api/qiskit/0.44/qiskit.extensions.{Hamiltonian,Unitary}Gate.md",
"docs/api/qiskit/release-notes/index.md",
];
Expand All @@ -200,11 +203,12 @@ async function determineCurrentDocsFileBatch(

let description: string;
if (args.currentApis && args.qiskitReleaseNotes) {
description = "non-API docs, current API docs, and Qiskit release notes";
description =
"non-API docs, current API docs, and latest Qiskit release note";
} else if (args.currentApis) {
description = "non-API docs and current API docs";
} else if (args.qiskitReleaseNotes) {
description = "non-API docs and Qiskit release notes";
description = "non-API docs and latest Qiskit release note";
} else {
description = "non-API docs";
}
Expand Down Expand Up @@ -254,23 +258,25 @@ async function determineHistoricalFileBatches(
const toCheck: string[] = [];
const toLoad = [...extraGlobsToLoad];

// Qiskit legacy release notes (< 0.45) have their own FileBatch, and we don't
// need to check them here.
const isBeforeQiskit0_45 = projectName === "qiskit" && +folder.name < 0.45;
if (!checkHistoricalApiDocs && isBeforeQiskit0_45) {
continue;
}

if (checkHistoricalApiDocs) {
toCheck.push(
`docs/api/${projectName}/${folder.name}/*`,
`public/api/${projectName}/${folder.name}/objects.inv`,
);
} else {
toLoad.push(`docs/api/${projectName}/${folder.name}/*`);
}

if (checkSeparateReleaseNotes) {
// Qiskit legacy release notes (< 0.45) have their own FileBatch, and we don't
// need to check them here
if (projectName == "qiskit" && +folder.name < 0.45) {
continue;
}

if (checkSeparateReleaseNotes && !isBeforeQiskit0_45) {
toCheck.push(`docs/api/${projectName}/release-notes/${folder.name}.md`);
if (!checkHistoricalApiDocs) {
toLoad.push(`docs/api/${projectName}/${folder.name}/*`);
}
}

const fileBatch = await FileBatch.fromGlobs(
Expand Down
Loading