Skip to content

Commit b42f248

Browse files
ci: automate lexicons updates (#36)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 4c4bf31 commit b42f248

File tree

4 files changed

+132
-2
lines changed

4 files changed

+132
-2
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update lexicons
2+
3+
permissions: {}
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch: {}
10+
merge_group: {}
11+
12+
jobs:
13+
main:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.head_ref || github.ref_name }}
21+
- run: corepack enable
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: pnpm
26+
27+
- name: 📦 Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: 📦 Update lexicons
31+
run: pnpm --filter @tsky/lexicons build
32+
33+
- name: ✅ Check if lexicons version was updated
34+
id: check-version-change
35+
run: echo "VERSION_CHANGED=$(pnpm run --silent --filter @tsky/lexicons check-version-change)" >> "$GITHUB_OUTPUT"
36+
37+
- name: 🔼 commit and push
38+
if: ${{ steps.check-version-change.outputs.VERSION_CHANGED == 'yes' }}
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+
git diff --quiet || (git add . && git commit -m "chore: update lexicons.ts")
43+
git push

packages/lexicons/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"scripts": {
2020
"build": "tsx ./scripts/generate-types.ts && tsc",
21+
"check-version-change": "tsx ./scripts/check-version-change.ts && tsc",
2122
"clean": "rm -rf dist && rm -rf lexicons",
2223
"prepublish": "pnpm run clean && pnpm run build"
2324
},
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { execSync } from 'node:child_process';
2+
import path from 'node:path';
3+
import process from 'node:process';
4+
import { fileURLToPath } from 'node:url';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
9+
const TYPES_OUTPUT_PATH = path.resolve(__dirname, '../src/lib/lexicons.ts');
10+
11+
async function main() {
12+
try {
13+
const command = [
14+
'git diff --unified=0',
15+
TYPES_OUTPUT_PATH,
16+
'| grep -q "* Source:"',
17+
'&& echo yes',
18+
'|| echo no',
19+
].join(' ');
20+
21+
execSync(command, {
22+
stdio: 'inherit',
23+
env: process.env,
24+
});
25+
} catch (error) {
26+
console.error('Error:', error);
27+
process.exit(1);
28+
}
29+
}
30+
31+
main();

packages/lexicons/src/lib/lexicons.ts

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* @module
66
* Contains type declarations for Bluesky lexicons
77
* @generated
8-
* Generated on: 2024-12-05T08:21:18.439Z
8+
* Generated on: 2025-01-09T12:45:41.061Z
99
* Version: main
10-
* Source: https://github.com/bluesky-social/atproto/tree/c72145dbeb2d67068bc28c00a13447e0d382d121/lexicons
10+
* Source: https://github.com/bluesky-social/atproto/tree/53621f8e100a3aa3c1caff10a08d3f4ea919875a/lexicons
1111
*/
1212

1313
/** Base type with optional type field */
@@ -1935,6 +1935,11 @@ export declare namespace AppBskyNotificationListNotifications {
19351935
*/
19361936
limit?: number;
19371937
priority?: boolean;
1938+
/**
1939+
* Notification reasons to include in response.
1940+
* A reason that matches the reason property of #notification.
1941+
*/
1942+
reasons?: string[];
19381943
seenAt?: string;
19391944
}
19401945
type Input = undefined;
@@ -2037,6 +2042,12 @@ export declare namespace AppBskyUnspeccedDefs {
20372042
interface SkeletonSearchStarterPack extends TypedBase {
20382043
uri: At.Uri;
20392044
}
2045+
interface TrendingTopic extends TypedBase {
2046+
link: string;
2047+
topic: string;
2048+
description?: string;
2049+
displayName?: string;
2050+
}
20402051
}
20412052

20422053
/** Get miscellaneous runtime configuration. */
@@ -2104,6 +2115,25 @@ export declare namespace AppBskyUnspeccedGetTaggedSuggestions {
21042115
}
21052116
}
21062117

2118+
/** Get a list of trending topics */
2119+
export declare namespace AppBskyUnspeccedGetTrendingTopics {
2120+
interface Params extends TypedBase {
2121+
/**
2122+
* Minimum: 1
2123+
* Maximum: 25
2124+
* \@default 10
2125+
*/
2126+
limit?: number;
2127+
/** DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. */
2128+
viewer?: At.DID;
2129+
}
2130+
type Input = undefined;
2131+
interface Output extends TypedBase {
2132+
suggested: AppBskyUnspeccedDefs.TrendingTopic[];
2133+
topics: AppBskyUnspeccedDefs.TrendingTopic[];
2134+
}
2135+
}
2136+
21072137
/** Backend Actors (profile) search, returns only skeleton. */
21082138
export declare namespace AppBskyUnspeccedSearchActorsSkeleton {
21092139
interface Params extends TypedBase {
@@ -3451,6 +3481,8 @@ export declare namespace ComAtprotoServerCreateSession {
34513481
/** Handle or other identifier supported by the server for the authenticating user. */
34523482
identifier: string;
34533483
password: string;
3484+
/** When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned */
3485+
allowTakendown?: boolean;
34543486
authFactorToken?: string;
34553487
}
34563488
interface Output extends TypedBase {
@@ -4249,6 +4281,8 @@ export declare namespace ToolsOzoneModerationDefs {
42494281
subjectStatus?: SubjectStatusView;
42504282
}
42514283
interface ModEventAcknowledge extends TypedBase {
4284+
/** If true, all other reports on content authored by this account will be resolved (acknowledged). */
4285+
acknowledgeAccountSubjects?: boolean;
42524286
comment?: string;
42534287
}
42544288
/** Add a comment to a subject */
@@ -4324,6 +4358,11 @@ export declare namespace ToolsOzoneModerationDefs {
43244358
comment?: string;
43254359
/** Indicates how long the takedown should be in effect before automatically expiring. */
43264360
durationInHours?: number;
4361+
/**
4362+
* Names/Keywords of the policies that drove the decision.
4363+
* Maximum array length: 5
4364+
*/
4365+
policies?: string[];
43274366
}
43284367
/** Unmute action on a subject */
43294368
interface ModEventUnmute extends TypedBase {
@@ -4641,6 +4680,8 @@ export declare namespace ToolsOzoneModerationQueryEvents {
46414680
* \@default 50
46424681
*/
46434682
limit?: number;
4683+
/** If specified, only events where the action policies match any of the given policies are returned */
4684+
policies?: string[];
46444685
/** If specified, only events where all of these labels were removed are returned */
46454686
removedLabels?: string[];
46464687
/** If specified, only events where all of these tags were removed are returned */
@@ -4703,6 +4744,12 @@ export declare namespace ToolsOzoneModerationQueryStatuses {
47034744
limit?: number;
47044745
/** When set to true, only muted subjects and reporters will be returned. */
47054746
onlyMuted?: boolean;
4747+
/** Number of queues being used by moderators. Subjects will be split among all queues. */
4748+
queueCount?: number;
4749+
/** Index of the queue to fetch subjects from. Works only when queueCount value is specified. */
4750+
queueIndex?: number;
4751+
/** A seeder to shuffle/balance the queue items. */
4752+
queueSeed?: string;
47064753
/** Search subjects reported after a given timestamp */
47074754
reportedAfter?: string;
47084755
/** Search subjects reported before a given timestamp */
@@ -4721,6 +4768,10 @@ export declare namespace ToolsOzoneModerationQueryStatuses {
47214768
subject?: string;
47224769
/** If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. */
47234770
subjectType?: "account" | "record" | (string & {});
4771+
/**
4772+
* Maximum array length: 25
4773+
* Items in this array are applied with OR filters. To apply AND filter, put all tags in the same string and separate using && characters
4774+
*/
47244775
tags?: string[];
47254776
/** Get subjects that were taken down */
47264777
takendown?: boolean;
@@ -5332,6 +5383,10 @@ export declare interface Queries {
53325383
"app.bsky.unspecced.getTaggedSuggestions": {
53335384
output: AppBskyUnspeccedGetTaggedSuggestions.Output;
53345385
};
5386+
"app.bsky.unspecced.getTrendingTopics": {
5387+
params: AppBskyUnspeccedGetTrendingTopics.Params;
5388+
output: AppBskyUnspeccedGetTrendingTopics.Output;
5389+
};
53355390
"app.bsky.unspecced.searchActorsSkeleton": {
53365391
params: AppBskyUnspeccedSearchActorsSkeleton.Params;
53375392
output: AppBskyUnspeccedSearchActorsSkeleton.Output;

0 commit comments

Comments
 (0)