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
54 changes: 54 additions & 0 deletions .github/workflows/build-and-preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
HUGO_PREVIEW: "true"
PREVIEW_BASE_URL: "/pr-preview/pr-${{ github.event.pull_request.number }}/"
run: |
make docs-build-production BASE_URL="/"
find docs/public -maxdepth 1 -type d -name 'v0.*' -exec rm -rf {} +
Expand Down Expand Up @@ -103,10 +104,12 @@ jobs:
path: gh-pages-maintenance

- name: Prune old PR previews
id: prune-previews
if: github.event.action != 'closed'
run: |
cd gh-pages-maintenance
mkdir -p pr-preview
removed_prs=()

mapfile -t previews < <(
while IFS= read -r preview; do
Expand All @@ -123,9 +126,11 @@ jobs:

for preview in "${previews[@]:PREVIEW_RETENTION_LIMIT}"; do
rm -rf "pr-preview/$preview"
removed_prs+=("${preview#pr-}")
done

if git diff --quiet -- pr-preview; then
echo "removed_prs=" >> "$GITHUB_OUTPUT"
exit 0
fi

Expand All @@ -135,6 +140,55 @@ jobs:
git commit -m "Prune old PR previews"
git push

echo "removed_prs=$(IFS=,; echo "${removed_prs[*]}")" >> "$GITHUB_OUTPUT"

- name: Comment on pruned previews
if: github.event.action != 'closed' && steps.prune-previews.outputs.removed_prs != ''
uses: actions/github-script@v7
env:
REMOVED_PRS: ${{ steps.prune-previews.outputs.removed_prs }}
PREVIEW_RETENTION_LIMIT: ${{ env.PREVIEW_RETENTION_LIMIT }}
with:
script: |
const removedPrs = process.env.REMOVED_PRS.split(",").filter(Boolean);
const retentionLimit = process.env.PREVIEW_RETENTION_LIMIT;

for (const prNumber of removedPrs) {
const body =
`Preview deployment for PR #${prNumber} removed.\n\n` +
`This PR preview was automatically pruned because we keep only the ${retentionLimit} most recently updated previews on GitHub Pages to stay within deployment size limits.\n\n` +
`If needed, push a new commit to this PR to generate a fresh preview.`;

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(prNumber),
});

const existingComment = [...comments].reverse().find((comment) =>
comment.user?.login === "github-actions[bot]" && (
comment.body?.includes(`Preview deployment for PR #${prNumber}`)
)
);

if (existingComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body,
});
continue;
}

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(prNumber),
body,
});
}

- name: Comment PR with Preview URL
if: github.event.action != 'closed'
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
2 changes: 1 addition & 1 deletion CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docs.meshery.io
drawnew.xyz
2 changes: 1 addition & 1 deletion docs/assets/scss/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,4 @@
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
}
}
}
4 changes: 2 additions & 2 deletions docs/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title = "Documentation"
relativeURLs = true
canonifyURLs = false

# Language settings

contentDir = "content/en"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
Expand All @@ -21,7 +21,7 @@ ignoreFiles = ["^meetings/.*", "^notes/.*", "^integrations/.*" ]
# Will give values to .Lastmod etc.
enableGitInfo = true

# Comment out to enable taxonomies in Docsy

# disableKinds = ["taxonomy", "term"]

# You can add your own taxonomies
Expand Down
Loading