From 57c5d17c9fb4fb661544f86eb1b0d90d70e56576 Mon Sep 17 00:00:00 2001 From: Puru Vijay Date: Mon, 23 Sep 2024 16:20:13 +0530 Subject: [PATCH] Fix broken links --- .github/workflows/checks.yaml | 7 +++++-- content/docs/05-sdk/11-typescript-reference.md | 6 +++--- scripts/checks.ts | 13 +++++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 5620c50..463595b 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -4,10 +4,13 @@ concurrency: group: docs-checks-${{ github.ref }} cancel-in-progress: true +# On push on all branches, and cron every 12 hours on: push: - branches-ignore: - - main + branches: + - '**' + schedule: + - cron: '0 */12 * * *' jobs: docs: diff --git a/content/docs/05-sdk/11-typescript-reference.md b/content/docs/05-sdk/11-typescript-reference.md index 26acd2c..cd15208 100644 --- a/content/docs/05-sdk/11-typescript-reference.md +++ b/content/docs/05-sdk/11-typescript-reference.md @@ -106,7 +106,7 @@ console.log(Person, AddReducer, SayHelloReducer); The database client connection to a SpacetimeDB server. -Defined in [spacetimedb-sdk.spacetimedb](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/src/spacetimedb.ts): +Defined in [spacetimedb-sdk.spacetimedb](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/packages/sdk/src/spacetimedb.ts): | Constructors | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | @@ -393,7 +393,7 @@ spacetimeDBClient.onError((...args: any[]) => { A unique public identifier for a user of a database. -Defined in [spacetimedb-sdk.identity](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/src/identity.ts): +Defined in [spacetimedb-sdk.identity](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/packages/sdk/src/identity.ts): | Constructors | Description | | ------------------------------------------------------------ | -------------------------------------------- | @@ -476,7 +476,7 @@ Identity.fromString(str: string): Identity An opaque identifier for a client connection to a database, intended to differentiate between connections from the same [`Identity`](#events-class-identity). -Defined in [spacetimedb-sdk.address](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/src/address.ts): +Defined in [spacetimedb-sdk.address](https://github.com/clockworklabs/spacetimedb-typescript-sdk/blob/main/packages/sdk/src/address.ts): | Constructors | Description | | ---------------------------------------------------------- | ------------------------------------------- | diff --git a/scripts/checks.ts b/scripts/checks.ts index 916361a..c7cd294 100644 --- a/scripts/checks.ts +++ b/scripts/checks.ts @@ -11,7 +11,7 @@ import { readdir, readFile } from 'node:fs/promises'; //////////////////////////////////////////////// !FLAGS //////////////////////////////////////////////// // If you want to disable any of these, set them to false -const CHECK_EXTERNAL_LINKS = false; +const CHECK_EXTERNAL_LINKS = true; const PRINT_ERRORS = true; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -335,7 +335,16 @@ async function checkLinks() { for (const link of linksToCheck) { console.log(kleur.dim().bold(` ${link}`)); - const response = await fetch(link); + const response = await fetch(link, { + // Required as crates.io doesn't allow non browser user agents + headers: { + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', + Accept: + 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8', + 'Accept-Language': 'en-US,en;q=0.9', + }, + }); if (!response.ok) { slugErrors.add({ message: `External: Link to ${link} is broken`,