Skip to content

Commit 6e8a4e5

Browse files
committed
Apply overrides from git commits
1 parent e04939d commit 6e8a4e5

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"mastodonDocsCommit": "f760ffcdf3371a641ba5d731dd33348fc6eb4fe6",
33
"mastodonVersion": "4.4.0",
44
"minimumMastodonVersion": "4.2.0",
5-
"blockedFiles": ["methods/notifications_alpha.md"]
5+
"blockedFiles": ["methods/notifications_alpha.md"],
6+
"overridesRepository": "https://github.com/abraham/documentation",
7+
"overrideCommits": ["b1d8f95b506e2d734876ef47ec0f4e1feb4f5618"]
68
}

dist/schema.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35184,6 +35184,28 @@
3518435184
"null"
3518535185
],
3518635186
"properties": {
35187+
"small": {
35188+
"description": "Details about the small preview version of the attachment.",
35189+
"oneOf": [
35190+
{
35191+
"$ref": "#/components/schemas/MetaDetails"
35192+
},
35193+
{
35194+
"type": "null"
35195+
}
35196+
]
35197+
},
35198+
"original": {
35199+
"description": "Details about the original version of the attachment.",
35200+
"oneOf": [
35201+
{
35202+
"$ref": "#/components/schemas/MetaDetails"
35203+
},
35204+
{
35205+
"type": "null"
35206+
}
35207+
]
35208+
},
3518735209
"focus": {
3518835210
"description": "Coordinates that may be used for smart thumbnail cropping -- see [Focal points for cropped media thumbnails]({{< relref \"api/guidelines#focal-points\" >}}) for more.",
3518935211
"type": [
@@ -35241,6 +35263,15 @@
3524135263
"description": "Official Mastodon API documentation"
3524235264
}
3524335265
},
35266+
"MetaDetails": {
35267+
"type": "object",
35268+
"description": "Additional entity definition for MetaDetails",
35269+
"properties": {},
35270+
"externalDocs": {
35271+
"url": "https://docs.joinmastodon.org/entities/MediaAttachment/#attributes",
35272+
"description": "Official Mastodon API documentation"
35273+
}
35274+
},
3524435275
"Notification": {
3524535276
"type": "object",
3524635277
"description": "Represents a notification of an event relevant to the user.",

scripts/setup-docs.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ function setupMastodonDocs(): void {
1818

1919
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
2020
const targetCommit = config.mastodonDocsCommit;
21+
const overrideCommits = config.overrideCommits || [];
22+
const overridesRepository = config.overridesRepository;
2123

2224
if (!targetCommit) {
2325
console.error('mastodonDocsCommit not found in config.json');
@@ -52,6 +54,36 @@ function setupMastodonDocs(): void {
5254
cwd: docsDir,
5355
});
5456

57+
// Apply override commits if any
58+
if (overrideCommits.length > 0) {
59+
console.log(`Adding ${overridesRepository} overrides remote...`);
60+
execSync(`git config user.email "[email protected]"`, {
61+
stdio: 'inherit',
62+
cwd: docsDir,
63+
});
64+
execSync(`git config user.name "bot"`, {
65+
stdio: 'inherit',
66+
cwd: docsDir,
67+
});
68+
execSync(`git remote add overrides ${overridesRepository} || true`, {
69+
stdio: 'inherit',
70+
cwd: docsDir,
71+
});
72+
execSync(`git fetch overrides`, {
73+
stdio: 'inherit',
74+
cwd: docsDir,
75+
});
76+
77+
console.log(`Applying ${overrideCommits.length} override commit(s)...`);
78+
for (const commit of overrideCommits) {
79+
console.log(`Cherry-picking commit ${commit}...`);
80+
execSync(`git cherry-pick ${commit}`, {
81+
stdio: 'inherit',
82+
cwd: docsDir,
83+
});
84+
}
85+
}
86+
5587
console.log('Mastodon documentation setup complete.');
5688
} catch (error) {
5789
console.error(

0 commit comments

Comments
 (0)