Skip to content

Commit ad0a551

Browse files
chore: Add GitHub Actions workflow file for enforcing metadata in docs (#2099)
This commit adds support for GitHub Actions check for enforcing metadata in docs such as date, tags, and title. Signed-off-by: Jugal Kishore <jugal@signoz.io>
1 parent a6741eb commit ad0a551

File tree

7 files changed

+648
-2
lines changed

7 files changed

+648
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Docs Metadata Guard
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "data/docs/**"
7+
- "next.config.js"
8+
- "scripts/check-docs-metadata.js"
9+
- "tests/docs-metadata.test.js"
10+
- "tests/fixtures/**"
11+
- "package.json"
12+
- ".github/workflows/docs-metadata-guard.yml"
13+
14+
jobs:
15+
check-metadata:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v6
25+
with:
26+
node-version: "20"
27+
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile --non-interactive
30+
31+
- name: Run docs metadata tests
32+
run: yarn test:docs-metadata
33+
34+
- name: Validate docs metadata
35+
run: yarn check:docs-metadata

.husky/pre-commit

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
#!/usr/bin/env sh
2-
32
set -e
43

54
echo 'husky (pre-commit): running lint-staged'
65
yarn lint-staged
76

87
STAGED_FILES=$(git diff --cached --name-only)
98

9+
# Check for docs redirect changes
1010
if printf '%s\n' "$STAGED_FILES" | grep -E '^(data/docs/.*\.mdx|next\.config\.js|scripts/check-doc-redirects\.js)$' >/dev/null; then
1111
echo 'husky (pre-commit): verifying docs redirects'
1212
yarn check:doc-redirects
1313
else
1414
echo 'husky (pre-commit): skipping docs redirect check (no relevant changes staged)'
1515
fi
16+
17+
# Check for docs metadata
18+
if printf '%s\n' "$STAGED_FILES" | grep -E '^data/docs/.*\.mdx$' >/dev/null; then
19+
echo 'husky (pre-commit): validating docs metadata'
20+
HUSKY_PRE_COMMIT=true yarn check:docs-metadata
21+
else
22+
echo 'husky (pre-commit): skipping docs metadata check (no documentation changes staged)'
23+
fi

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ Thanks for helping improve SigNoz documentation. Clear, complete docs are critic
3939
- Pre-commit behavior
4040
- Runs `lint-staged` on staged files. ESLint and Prettier fix typical JS/TS/MD/MDX formatting and lint issues.
4141
- When changes include docs or redirect-related files (`data/docs/**/*.mdx`, `next.config.js`, or `scripts/check-doc-redirects.js`), it runs `yarn check:doc-redirects` to ensure renamed/moved docs have permanent redirects.
42+
- When changes include docs (`data/docs/**/*.mdx`), it runs `yarn check:docs-metadata` to ensure metadata such as date, description, tag, title is complete and correct.
4243
- Fixing failures
4344
- Lint/format: run `yarn lint` or re-stage after auto-fixes from Prettier/ESLint.
4445
- Redirects: run `yarn check:doc-redirects` locally to see missing entries, then add a permanent redirect in `next.config.js` under `async redirects()`. Re-stage and commit.
46+
- Metadata: run `yarn check:docs-metadata` locally to see missing/invalid entries, then update the metadata in the `.mdx` file. Re-stage and commit.
4547
- Optional: `yarn test:doc-redirects` runs a small test for redirect rules.
4648
- Hooks path
4749
- The repo uses Husky v9 defaults (`core.hooksPath=.husky`). If your local Git still points elsewhere (e.g., `.husky/_` from older setups), run `git config core.hooksPath .husky` or re-run `yarn install` to refresh hooks.
@@ -54,6 +56,10 @@ Thanks for helping improve SigNoz documentation. Clear, complete docs are critic
5456
- Triggers on PRs that touch `data/docs/**`, `next.config.js`, `scripts/check-doc-redirects.js`, tests, or `package.json`.
5557
- Runs `yarn test:doc-redirects` and `yarn check:doc-redirects`.
5658
- Fails if redirects are missing/invalid or tests fail. Fix by adding permanent redirects in `next.config.js` and re-running locally.
59+
- Docs Metadata Guard
60+
- Triggers on PRs that touch `data/docs/**`, `next.config.js`, `scripts/check-docs-metadata.js`, tests, or `package.json`.
61+
- Runs `yarn test:docs-metadata` and `yarn check:docs-metadata`.
62+
- Fails if title, date, description are missing/invalid, and warns if tags are missing from MDX files. Fix by adding relevant metadata in MDX file and re-running locally.
5763
- Add to Onboarding (label-driven)
5864
- When a PR is labeled `add-to-onboarding`, this job checks that the PR includes docs changes. If none are found, the job fails with a message.
5965
- If docs are present, it auto-creates an onboarding issue listing changed docs and comments on the PR with a link.
@@ -163,6 +169,7 @@ Every doc should be skimmable and actionable.
163169
```
164170

165171
- Use descriptive anchor text that makes the link destination clear. Avoid generic phrases like "here" or "link" and do not paste raw URLs into the body text.
172+
166173
- ✅ `Learn from the [Temporal Golang sample repository](https://github.com/SigNoz/temporal-golang-opentelemetry/tree/main)`
167174
- ❌ `See (link)` or `Refer to https://github.com/...`
168175

data/docs/mastra-observability.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ When you click on a trace in SigNoz, you'll see a detailed view of the trace, in
143143

144144
You can also check out our custom Mastra dashboard [here](https://signoz.io/docs/dashboards/dashboard-templates/mastra-dashboard/) which provides specialized visualizations for monitoring your Masrta usage in applications. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.
145145

146-
<Figure src="/img/docs/llm/mastra/mastra-dashboard.webp" alt="Mastra Dashboard" caption="Mastra Dashboard Template" />
146+
<Figure src="/img/docs/llm/mastra/mastra-dashboard.webp" alt="Mastra Dashboard" caption="Mastra Dashboard Template" />

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"lint": "next lint --fix --dir pages --dir app --dir components --dir lib --dir layouts --dir scripts",
1212
"check:doc-redirects": "node scripts/check-doc-redirects.js",
1313
"test:doc-redirects": "node --test tests/doc-redirects.test.js",
14+
"check:docs-metadata": "node scripts/check-docs-metadata.js",
15+
"test:docs-metadata": "node --test tests/docs-metadata.test.js",
1416
"prepare": "husky"
1517
},
1618
"dependencies": {

0 commit comments

Comments
 (0)