-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDDS-9866. Add GitHub Actions checks for consistent Docusaurus formatting. #84
Merged
adoroszlai
merged 14 commits into
apache:HDDS-9225-website-v2
from
errose28:HDDS-9866-docusaurus-format
Mar 7, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fa25845
Frontmatter validation via docusaurus plugin
errose28 addb683
Add sidebar check
errose28 779bbbf
Remove extra newlines
errose28 be055f5
Fix frontamtter keys in documents
errose28 b3cecd6
Include mdx in spelling check
errose28 bf3ef4d
Massive speedup in sidebar check by batching to ajv
errose28 235ea4a
Fix ratis streaming link
errose28 32d3628
Merge branch 'HDDS-9225-website-v2' into HDDS-9866-docusaurus-format
errose28 b3a6d5e
Add more detail in schema check comments
errose28 1ea372b
Clearer error message from sidebar script
errose28 f3ee871
Undo change to spelling script
errose28 503da60
Updates after reviewing diff
errose28 4f6f7ed
Print the json schema file path when errors occur
errose28 c785de5
Fix spelling of "front matter"
errose28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://ozone.apache.org/category.schema.json", | ||
"title": "Category", | ||
"description": "Validates an allowed subset of keys in Docusaurus _category_.yml files.", | ||
"type": "object", | ||
"properties": { | ||
"label": { | ||
"description": "The name of this section shown in the docs sidebar.", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"label" | ||
], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://ozone.apache.org/frontmatter.schema.json", | ||
"title": "Frontmatter", | ||
"description": "Validates an allowed subset of Docusaurus docs frontmatter.", | ||
"type": [ "object", "null" ], | ||
"properties": { | ||
"sidebar_label": { | ||
"type": "string" | ||
}, | ||
"slug": { | ||
"description": "Only use slug to specify the base URL for documentation.", | ||
"type": "string", | ||
"enum": [ "/" ] | ||
}, | ||
"draft": { | ||
"description": "Makes pages for incomplete features only visible in development mode.", | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env sh | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Validates docusaurus _category_.yml files used to configure the docs sidebar. | ||
# Each docs subdirectory should have a _category_.yml file, and it must follow the defined schema. | ||
# The schema is more restrictive than what Docusaurus allows, and can be used to disallow keys or require all category | ||
# files to define the same keys. | ||
|
||
rc=0 | ||
|
||
root="$(git rev-parse --show-toplevel)" | ||
schema="$root"/.github/resource/category.schema.json | ||
|
||
# Make sure all docs directories have a category sidebar file. | ||
for child in $(find "$root"/docs/*); do | ||
if [ -d "$child" ]; then | ||
category_file="$child/_category_.yml" | ||
if [ ! -f "$category_file" ]; then | ||
echo "_category_.yml is required for docs subdirectory $child" 1>&2 | ||
rc=1 | ||
fi | ||
fi | ||
done | ||
|
||
[ "$rc" = 0 ] || exit $rc | ||
|
||
# If all category files are present, make sure they follow the schema. | ||
if ! pnpm ajv validate -s "$schema" -d "$root/docs/**/_category_.yml" 1>/dev/null; then | ||
rc=1 | ||
echo "Sidebar configuration validation failed against JSON schema $schema" 1>&2 | ||
fi | ||
|
||
exit "$rc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,6 @@ words: | |
- gpg | ||
- sed | ||
- mds | ||
- frontmatter | ||
- javadoc | ||
# Misc words | ||
- acking | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think reduce iterations by using
-type d
as infind "$root"/docs -type d