From 0746f827d6e42aa62d3c42d87448e9dc5daef41e Mon Sep 17 00:00:00 2001
From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date: Thu, 31 Oct 2024 14:37:47 -0400
Subject: [PATCH] Ignore announcements in link checker
---
docs/guides/latest-updates.mdx | 2 +-
scripts/js/commands/checkInternalLinks.ts | 4 ----
scripts/js/lib/links/FileBatch.ts | 2 ++
scripts/js/lib/links/ignores.ts | 8 ++++++++
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/docs/guides/latest-updates.mdx b/docs/guides/latest-updates.mdx
index 7e91d26559c..1434503f753 100644
--- a/docs/guides/latest-updates.mdx
+++ b/docs/guides/latest-updates.mdx
@@ -202,5 +202,5 @@ Join, participate, contribute! See what events are coming up on the [Qiskit comm
## See all product updates
-Visit the [Product announcements](https://docs.quantum.ibm.com/announcements/product-updates) to browse all product updates and news.
+Visit the [Product announcements](/announcements/product-updates) to browse all product updates and news.
diff --git a/scripts/js/commands/checkInternalLinks.ts b/scripts/js/commands/checkInternalLinks.ts
index e17a93aeba7..1badf90ba70 100644
--- a/scripts/js/commands/checkInternalLinks.ts
+++ b/scripts/js/commands/checkInternalLinks.ts
@@ -26,9 +26,7 @@ const SYNTHETIC_FILES: string[] = [
"docs/errors.mdx",
"docs/api/runtime/index.mdx",
"docs/api/runtime/tags/jobs.mdx",
- "docs/announcements/product-updates/2024-04-15-backend-run-deprecation.mdx",
"docs/api/qiskit-transpiler-service-rest/index.mdx",
- "docs/announcements/product-updates/2024-09-16-code-assistant.mdx",
];
interface Arguments {
@@ -277,8 +275,6 @@ async function determineHistoricalFileBatches(
}
async function determineQiskitLegacyReleaseNotes(): Promise {
- const result: FileBatch[] = [];
-
const legacyVersions = (
await globby("docs/api/qiskit/release-notes/[!index]*")
)
diff --git a/scripts/js/lib/links/FileBatch.ts b/scripts/js/lib/links/FileBatch.ts
index 1a520d0b649..4071220d4ff 100644
--- a/scripts/js/lib/links/FileBatch.ts
+++ b/scripts/js/lib/links/FileBatch.ts
@@ -15,6 +15,7 @@ import { globby } from "globby";
import { InternalLink, File } from "./InternalLink.js";
import {
ALWAYS_IGNORED_URLS,
+ ALWAYS_IGNORED_URL_PREFIXES,
FILES_TO_IGNORES,
IGNORED_FILES,
} from "./ignores.js";
@@ -115,6 +116,7 @@ export function addLinksToMap(
links.forEach((link) => {
if (
ALWAYS_IGNORED_URLS.has(link) ||
+ ALWAYS_IGNORED_URL_PREFIXES.some((prefix) => link.startsWith(prefix)) ||
FILES_TO_IGNORES[filePath]?.includes(link)
) {
return;
diff --git a/scripts/js/lib/links/ignores.ts b/scripts/js/lib/links/ignores.ts
index 670c029ecfb..f7b9fb12137 100644
--- a/scripts/js/lib/links/ignores.ts
+++ b/scripts/js/lib/links/ignores.ts
@@ -76,6 +76,14 @@ export const ALWAYS_IGNORED_URLS = new Set([
...ALWAYS_IGNORED_URLS__SHOULD_FIX,
]);
+// -----------------------------------------------------------------------------------
+// Always ignored URL prefixes - be careful using this
+// -----------------------------------------------------------------------------------
+
+export const ALWAYS_IGNORED_URL_PREFIXES: string[] = [
+ "/announcements/product-updates",
+];
+
// -----------------------------------------------------------------------------------
// Files to ignores
// -----------------------------------------------------------------------------------