Skip to content

Commit

Permalink
Fix broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
PuruVJ committed Sep 23, 2024
1 parent e669bfe commit 57c5d17
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions content/docs/05-sdk/11-typescript-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
Expand Down Expand Up @@ -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 |
| ------------------------------------------------------------ | -------------------------------------------- |
Expand Down Expand Up @@ -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 |
| ---------------------------------------------------------- | ------------------------------------------- |
Expand Down
13 changes: 11 additions & 2 deletions scripts/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
///////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -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`,
Expand Down

0 comments on commit 57c5d17

Please # to comment.