Skip to content

Commit a2eb872

Browse files
Add screenshot validation script (#544)
* Draft code * Updates * Add: Validate document workflow * Add `.validationignore` file and accompanying logic to `validate-document.js` * Update `validate-document.yml` workflow * Add missing `console.log` to image checks. * Fix: #544 (comment) * Update website/validate-document.js Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> * Update website/validate-document.js Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> * Update website/.validationignore Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> * Update website/validate-document.js Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> * Fix: #544 (comment) * Fix: #544 (comment) * Update website/.validationignore Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> * Add sharp * Add: `checkImageDimensions` function. * Add `sharp` to npm install dependencies * Update website/validate-document.js Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com> --------- Co-authored-by: adams85 <31276480+adams85@users.noreply.github.com>
1 parent 2ecdc43 commit a2eb872

File tree

5 files changed

+967
-1
lines changed

5 files changed

+967
-1
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Validate Document
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- "website/**/.mdx"
9+
10+
workflow_dispatch:
11+
inputs:
12+
logLevel:
13+
description: "Log level"
14+
required: true
15+
default: "warning"
16+
type: choice
17+
options:
18+
- info
19+
- warning
20+
- debug
21+
22+
jobs:
23+
validate_document:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "22"
36+
cache: "npm"
37+
cache-dependency-path: website/package-lock.json
38+
39+
- name: Install dependencies
40+
run: npm install ignore sharp
41+
42+
- name: Run validate document script
43+
run: |
44+
FILES=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep '\.mdx$')
45+
echo "Changed document files: $FILES"
46+
if [ -z "$FILES" ]; then
47+
echo "No document files changed."
48+
exit 0
49+
fi
50+
51+
# Filter out files that no longer exist
52+
EXISTING_FILES=""
53+
for FILE in $FILES; do
54+
if [ -f "$FILE" ]; then
55+
EXISTING_FILES="$EXISTING_FILES $FILE"
56+
else
57+
echo "Warning: File '$FILE' no longer exists and will be skipped."
58+
fi
59+
done
60+
61+
if [ -z "$EXISTING_FILES" ]; then
62+
echo "No existing markdown files found after filtering."
63+
exit 0
64+
fi
65+
66+
node website/validate-document.js $EXISTING_FILES

website/.validationignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# DO NOT ADD NEW ENTRIES TO THIS FILE. New documents should be created
2+
# according to the guidelines outlined in https://github.com/configcat-labs/content-wiki/blob/main/screenshot-guide.md. For older
3+
# documents, we don't enforce every rule. However, when a document is updated,
4+
# it should be removed from here and adjusted to conform to the new guidelines.
5+
6+
/docs/advanced/caching.mdx
7+
/docs/advanced/cli.mdx
8+
/docs/advanced/code-references/_intro.mdx
9+
/docs/advanced/code-references/azure-devops.mdx
10+
/docs/advanced/code-references/bitbucket-pipe.mdx
11+
/docs/advanced/code-references/bitrise-step.mdx
12+
/docs/advanced/code-references/circleci-orb.mdx
13+
/docs/advanced/code-references/github-action.mdx
14+
/docs/advanced/code-references/gitlab-ci.mdx
15+
/docs/advanced/code-references/manual.mdx
16+
/docs/advanced/code-references/overview.mdx
17+
/docs/advanced/config-v2-migration-guide.mdx
18+
/docs/advanced/config-v2-sdk-compatibility.mdx
19+
/docs/advanced/config-v2.mdx
20+
/docs/advanced/data-governance.mdx
21+
/docs/advanced/migration-from-launchdarkly-translation.mdx
22+
/docs/advanced/migration-from-launchdarkly.mdx
23+
/docs/advanced/notifications-webhooks.mdx
24+
/docs/advanced/proxy/endpoints.mdx
25+
/docs/advanced/proxy/grpc.mdx
26+
/docs/advanced/proxy/monitoring.mdx
27+
/docs/advanced/proxy/overview.mdx
28+
/docs/advanced/team-management/auto-assign-users.mdx
29+
/docs/advanced/team-management/domain-verification.mdx
30+
/docs/advanced/team-management/saml/identity-providers/adfs.mdx
31+
/docs/advanced/team-management/saml/identity-providers/auth0.mdx
32+
/docs/advanced/team-management/saml/identity-providers/azure-ad.mdx
33+
/docs/advanced/team-management/saml/identity-providers/cloudflare.mdx
34+
/docs/advanced/team-management/saml/identity-providers/google.mdx
35+
/docs/advanced/team-management/saml/identity-providers/okta.mdx
36+
/docs/advanced/team-management/saml/identity-providers/onelogin.mdx
37+
/docs/advanced/team-management/saml/overview.mdx
38+
/docs/advanced/team-management/single-sign-on-sso.mdx
39+
/docs/advanced/team-management/team-management-basics.mdx
40+
/docs/advanced/troubleshooting.mdx
41+
/docs/faq.mdx
42+
/docs/getting-started.mdx
43+
/docs/glossary/alpha-testing.mdx
44+
/docs/glossary/beta-testing.mdx
45+
/docs/glossary/blue-green-deployment.mdx
46+
/docs/glossary/ci-cd-pipeline.mdx
47+
/docs/glossary/continuous-integration.mdx
48+
/docs/glossary/devops-engineer.mdx
49+
/docs/glossary/feature-testing.mdx
50+
/docs/glossary/multi-armed-bandit.mdx
51+
/docs/glossary/product-lifecycle-manager.mdx
52+
/docs/glossary/release-manager.mdx
53+
/docs/glossary/remote-configuration.mdx
54+
/docs/glossary/smoke-testing.mdx
55+
/docs/glossary/type-i-and-type-ii-errors.mdx
56+
/docs/glossary/version-control.mdx
57+
/docs/glossary/what-is-a-staging-environment.mdx
58+
/docs/glossary.mdx
59+
/docs/integrations/amplitude.mdx
60+
/docs/integrations/bitbucket.mdx
61+
/docs/integrations/bitrise.mdx
62+
/docs/integrations/circleci.mdx
63+
/docs/integrations/datadog.mdx
64+
/docs/integrations/github.mdx
65+
/docs/integrations/google-analytics.mdx
66+
/docs/integrations/intellij.mdx
67+
/docs/integrations/jira.mdx
68+
/docs/integrations/mixpanel.mdx
69+
/docs/integrations/monday.mdx
70+
/docs/integrations/overview.mdx
71+
/docs/integrations/pubnub.mdx
72+
/docs/integrations/segment.mdx
73+
/docs/integrations/slack.mdx
74+
/docs/integrations/terraform.mdx
75+
/docs/integrations/trello.mdx
76+
/docs/integrations/vscode.mdx
77+
/docs/integrations/zapier.mdx
78+
/docs/integrations/zoho-flow.mdx
79+
/docs/main-concepts.mdx
80+
/docs/network-traffic.mdx
81+
/docs/news.mdx
82+
/docs/organization.mdx
83+
/docs/purchase.mdx
84+
/docs/requests.mdx
85+
/docs/sdk-reference/android.mdx
86+
/docs/sdk-reference/community/deno.mdx
87+
/docs/sdk-reference/community/laravel.mdx
88+
/docs/sdk-reference/community/vue.mdx
89+
/docs/sdk-reference/cpp.mdx
90+
/docs/sdk-reference/dart.mdx
91+
/docs/sdk-reference/dotnet.mdx
92+
/docs/sdk-reference/elixir.mdx
93+
/docs/sdk-reference/go.mdx
94+
/docs/sdk-reference/ios.mdx
95+
/docs/sdk-reference/java.mdx
96+
/docs/sdk-reference/js-ssr.mdx
97+
/docs/sdk-reference/js.mdx
98+
/docs/sdk-reference/kotlin.mdx
99+
/docs/sdk-reference/node.mdx
100+
/docs/sdk-reference/openfeature/dotnet.mdx
101+
/docs/sdk-reference/openfeature/go.mdx
102+
/docs/sdk-reference/openfeature/java.mdx
103+
/docs/sdk-reference/openfeature/js.mdx
104+
/docs/sdk-reference/openfeature/node.mdx
105+
/docs/sdk-reference/openfeature/overview.mdx
106+
/docs/sdk-reference/openfeature/php.mdx
107+
/docs/sdk-reference/openfeature/python.mdx
108+
/docs/sdk-reference/openfeature/rust.mdx
109+
/docs/sdk-reference/overview.mdx
110+
/docs/sdk-reference/php.mdx
111+
/docs/sdk-reference/python.mdx
112+
/docs/sdk-reference/react.mdx
113+
/docs/sdk-reference/ruby.mdx
114+
/docs/sdk-reference/rust.mdx
115+
/docs/sdk-reference/unity.mdx
116+
/docs/sdk-reference/unreal.mdx
117+
/docs/service/status.mdx
118+
/docs/subscription-plan-limits.mdx
119+
/docs/targeting/feature-flag-evaluation.mdx
120+
/docs/targeting/percentage-options.mdx
121+
/docs/targeting/targeting-overview.mdx
122+
/docs/targeting/targeting-rule/flag-condition.mdx
123+
/docs/targeting/targeting-rule/segment-condition.mdx
124+
/docs/targeting/targeting-rule/targeting-rule-overview.mdx
125+
/docs/targeting/targeting-rule/user-condition.mdx
126+
/docs/targeting/user-object.mdx
127+
128+
/api/**/*.mdx
129+
/versioned_docs/**/*.mdx

0 commit comments

Comments
 (0)