Skip to content
Merged
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
48 changes: 46 additions & 2 deletions .github/workflows/sync-versioned-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,56 @@ jobs:
if git ls-tree -d origin/2.6.x -- dist/schemas/2.6.0 > /dev/null 2>&1; then
# Remove existing 2.6.0 schemas to ensure clean sync
rm -rf dist/schemas/2.6.0

# Extract dist/schemas/2.6.0 folder from 2.6.x branch
git archive origin/2.6.x -- dist/schemas/2.6.0 | tar -x
echo "Synced dist/schemas/2.6.0 from 2.6.x branch"
else
echo "dist/schemas/2.6.0 does not exist in 2.6.x branch, skipping"
fi

- name: Sync navigation from 2.6.x docs.json
run: |
# Extract docs.json from 2.6.x branch
git show origin/2.6.x:docs.json > /tmp/source-docs.json

# Create jq script to transform navigation
# Takes the first version's groups from 2.6.x (which has the actual content)
# and transforms all paths by prepending "v2.6-rc/"
cat << 'JQSCRIPT' > /tmp/transform.jq
def transform_paths:
if type == "array" then
map(transform_paths)
elif type == "object" then
if has("pages") then
.pages = (.pages | transform_paths)
else
.
end
elif type == "string" then
"v2.6-rc/" + .
else
.
end;

# $source is from --slurpfile (array), so use $source[0]
($source[0].navigation.versions[0].groups | transform_paths) as $transformed |
(.navigation.versions | to_entries | map(select(.value.version == "2.6-rc")) | .[0].key) as $idx |
if $idx != null then
.navigation.versions[$idx].groups = $transformed
else
.
end
JQSCRIPT

# Apply transformation: read source groups from 2.6.x, transform paths, update main's docs.json
jq --slurpfile source /tmp/source-docs.json -f /tmp/transform.jq docs.json > /tmp/updated-docs.json

# Replace docs.json with updated version
mv /tmp/updated-docs.json docs.json

echo "Synced navigation from 2.6.x docs.json to v2.6-rc version"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
Expand All @@ -57,10 +99,12 @@ jobs:
This PR syncs from the 2.6.x branch:
- Documentation to `v2.6-rc/docs/`
- Schemas to `dist/schemas/2.6.0/` (if available)

- Navigation config from 2.6.x's docs.json to main's v2.6-rc version

Auto-generated by the sync-versioned-docs workflow.
branch: auto/sync-v2.6-rc
delete-branch: true
add-paths: |
v2.6-rc/
dist/schemas/2.6.0/
docs.json