Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: "Check out repository code"
uses: "actions/checkout@v6"
- name: Check for file changes
uses: dorny/paths-filter@v3
uses: dorny/paths-filter@v4
id: changes
with:
token: ${{ github.token }}
Expand Down
20 changes: 20 additions & 0 deletions docs/sidebars/sidebar-utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
import { existsSync } from 'fs';
import { join } from 'path';

/**
* Detects the base directory containing the docs content (python-sdk/, infrahubctl/, etc.).
*
* The sidebar files live in different locations depending on which repo they are in:
* - infrahub-sdk-python: docs/sidebars/ → content is at docs/docs/
* - infrahub-docs: docs/ → content is at docs/docs-python-sdk/
*
* We detect the active layout by checking whether the SDK-repo content path exists.
*/
export function getDocsBaseDir(): string {
const sdkRepoDocsDir = join(__dirname, '..', 'docs');
if (existsSync(join(sdkRepoDocsDir, 'python-sdk'))) {
return sdkRepoDocsDir;
}
return join(__dirname, 'docs-python-sdk');
}

export function getCommandItems(files: string[], indexFile: string = 'infrahubctl.mdx'): string[] {
return files
.filter(file => file.endsWith('.mdx') && file !== indexFile)
Expand Down
4 changes: 2 additions & 2 deletions docs/sidebars/sidebars-infrahubctl.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
import {readdirSync} from 'fs';
import {join} from 'path';
import {getCommandItems} from './sidebar-utils';
import {getCommandItems, getDocsBaseDir} from './sidebar-utils';

const docsDir = join(__dirname, '..', 'docs', 'infrahubctl');
const docsDir = join(getDocsBaseDir(), 'infrahubctl');
const commandItems = getCommandItems(readdirSync(docsDir));

const sidebars: SidebarsConfig = {
Expand Down
4 changes: 2 additions & 2 deletions docs/sidebars/sidebars-python-sdk.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
import { readdirSync } from 'fs';
import { join } from 'path';
import { getItemsWithOrder } from './sidebar-utils';
import { getDocsBaseDir, getItemsWithOrder } from './sidebar-utils';

const pythonSdkDocsDir = join(__dirname, '..', 'docs', 'python-sdk');
const pythonSdkDocsDir = join(getDocsBaseDir(), 'python-sdk');

const guidesItems = getItemsWithOrder(
readdirSync(join(pythonSdkDocsDir, 'guides')),
Expand Down
Loading
Loading