Skip to content

Commit 4322996

Browse files
authored
Merge branch 'master' into fix/events-image-alignment-v2
Signed-off-by: Ankit Rewar <171806101+AnkitRewar11@users.noreply.github.com>
2 parents 23f55f9 + fdb1757 commit 4322996

16 files changed

Lines changed: 887 additions & 186 deletions

File tree

.github/workflows/build-and-preview-site.yml

Lines changed: 114 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,35 @@ concurrency:
1313
group: preview-${{ github.event.pull_request.number || github.run_id }}
1414
cancel-in-progress: true
1515

16+
defaults:
17+
run:
18+
shell: bash
19+
1620
jobs:
1721
preview:
1822
runs-on: ubuntu-latest
23+
outputs:
24+
removed_prs_json: ${{ steps.prune-previews.outputs.removed_prs_json }}
25+
env:
26+
PREVIEW_RETENTION_LIMIT: 6
1927

2028
steps:
2129

2230
- name: Checkout PR
2331
if: github.event.action != 'closed'
24-
uses: actions/checkout@v4
32+
uses: actions/checkout@v6
2533
with:
2634
ref: ${{ github.event.pull_request.head.sha }}
2735

2836
- name: Checkout gh-pages for cleanup
2937
if: github.event.action == 'closed'
30-
uses: actions/checkout@v4
38+
uses: actions/checkout@v6
3139
with:
3240
ref: gh-pages
3341

3442
- name: Setup Node
3543
if: github.event.action != 'closed'
36-
uses: actions/setup-node@v4
44+
uses: actions/setup-node@v6
3745
with:
3846
node-version: "20"
3947

@@ -67,17 +75,116 @@ jobs:
6775
action: auto
6876
comment: false
6977

78+
- name: Checkout gh-pages for preview retention
79+
if: github.event.action != 'closed'
80+
uses: actions/checkout@v6
81+
with:
82+
ref: gh-pages
83+
fetch-depth: 0
84+
path: gh-pages-maintenance
85+
86+
- name: Prune old PR previews
87+
id: prune-previews
88+
if: github.event.action != 'closed'
89+
run: |
90+
cd gh-pages-maintenance
91+
mkdir -p pr-preview
92+
removed_prs=()
93+
94+
mapfile -t previews < <(
95+
while IFS= read -r preview; do
96+
timestamp="$(git log -1 --format=%ct -- "pr-preview/$preview" 2>/dev/null || echo 0)"
97+
printf '%s %s\n' "$timestamp" "$preview"
98+
done < <(find pr-preview -mindepth 1 -maxdepth 1 -type d -name 'pr-*' -printf '%f\n') \
99+
| sort -nr \
100+
| awk '{print $2}'
101+
)
102+
103+
if (( ${#previews[@]} <= PREVIEW_RETENTION_LIMIT )); then
104+
echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT"
105+
exit 0
106+
fi
107+
108+
for preview in "${previews[@]:PREVIEW_RETENTION_LIMIT}"; do
109+
rm -rf "pr-preview/$preview"
110+
removed_prs+=("${preview#pr-}")
111+
done
112+
113+
if git diff --quiet -- pr-preview; then
114+
echo "removed_prs=" >> "$GITHUB_OUTPUT"
115+
echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT"
116+
exit 0
117+
fi
118+
119+
git config user.name "github-actions[bot]"
120+
git config user.email "github-actions[bot]@users.noreply.github.com"
121+
git add pr-preview
122+
git commit -m "Prune old PR previews"
123+
git push
124+
125+
echo "removed_prs=$(IFS=,; echo "${removed_prs[*]}")" >> "$GITHUB_OUTPUT"
126+
echo "removed_prs_json=$(printf '%s\n' "${removed_prs[@]}" | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
127+
70128
- name: Comment PR with Preview URL
71129
if: github.event.action != 'closed'
72130
uses: marocchino/sticky-pull-request-comment@v2
73131
with:
74132
header: pr-preview
75133
message: |
76-
🚀 **Preview for PR #${{ github.event.pull_request.number }}**
77-
78-
🌐 https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
134+
🚀 Preview deployment: https://layer5.io/pr-preview/pr-${{ github.event.pull_request.number }}/
135+
> *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment)*
79136
80-
- name: Cleanup PR preview
137+
- name: Comment on pruned previews
138+
if: github.event.action != 'closed' && steps.prune-previews.outputs.removed_prs_json != '[]'
139+
uses: actions/github-script@v7
140+
env:
141+
REMOVED_PRS_JSON: ${{ steps.prune-previews.outputs.removed_prs_json }}
142+
PREVIEW_RETENTION_LIMIT: ${{ env.PREVIEW_RETENTION_LIMIT }}
143+
with:
144+
script: |
145+
const removedPrs = JSON.parse(process.env.REMOVED_PRS_JSON);
146+
const retentionLimit = process.env.PREVIEW_RETENTION_LIMIT;
147+
const header = "pr-preview";
148+
const marker = `<!-- Sticky Pull Request Comment${header} -->`;
149+
150+
for (const prNumber of removedPrs) {
151+
const body =
152+
`Preview deployment for PR #${prNumber} removed.\n\n` +
153+
`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` +
154+
`If needed, push a new commit to this PR to generate a fresh preview.\n` +
155+
`${marker}`;
156+
157+
const { data: comments } = await github.rest.issues.listComments({
158+
owner: context.repo.owner,
159+
repo: context.repo.repo,
160+
issue_number: Number(prNumber),
161+
per_page: 100,
162+
});
163+
164+
const existingComment = [...comments].reverse().find((comment) =>
165+
comment.user?.login === "github-actions[bot]" &&
166+
comment.body?.includes(marker)
167+
);
168+
169+
if (existingComment) {
170+
await github.rest.issues.updateComment({
171+
owner: context.repo.owner,
172+
repo: context.repo.repo,
173+
comment_id: existingComment.id,
174+
body,
175+
});
176+
continue;
177+
}
178+
179+
await github.rest.issues.createComment({
180+
owner: context.repo.owner,
181+
repo: context.repo.repo,
182+
issue_number: Number(prNumber),
183+
body,
184+
});
185+
}
186+
187+
- name: Cleanup PR preview on close
81188
if: github.event.action == 'closed'
82189
uses: rossjrw/pr-preview-action@v1.6.3
83190
with:

gatsby-config.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ const siteOrigin = (process.env.GATSBY_SITE_URL || "https://layer5.io").replace(
1313
/\/$/,
1414
"",
1515
);
16-
const rawPathPrefix = process.env.PATH_PREFIX || "";
17-
const pathPrefix = rawPathPrefix
18-
? `/${rawPathPrefix.replace(/^\/+|\/+$/g, "")}`
19-
: "";
16+
const rawPrefix = process.env.PATH_PREFIX;
17+
const pathPrefix =
18+
rawPrefix && String(rawPrefix).trim().length
19+
? `/${String(rawPrefix).replace(/^\/+|\/+$/g, "")}`
20+
: undefined;
21+
2022
const siteRootUrl = `${siteOrigin}${pathPrefix}`.replace(/\/$/, "");
2123
const shouldBuildFullSite = isFullSiteBuild();
2224
const isLiteDevBuild = isDevelopment && !shouldBuildFullSite;
@@ -39,6 +41,7 @@ collectionIgnoreGlobs.length > 0
3941
)
4042
: console.info("Build Scope includes all collections");
4143
module.exports = {
44+
...(pathPrefix != null ? { pathPrefix } : {}),
4245
siteMetadata: {
4346
title: "Layer5 - Expect more from your infrastructure",
4447
description:
@@ -49,7 +52,6 @@ module.exports = {
4952
image: "/images/layer5-gradient.webp",
5053
twitterUsername: "@layer5",
5154
},
52-
...(pathPrefix ? { pathPrefix } : {}),
5355
flags: {
5456
FAST_DEV: false,
5557
DEV_SSR: false,

package-lock.json

Lines changed: 32 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@mui/icons-material": "^7.3.5",
4949
"@mui/material": "^7.3.4",
5050
"@react-icons/all-files": "^4.1.0",
51-
"@sistent/sistent": "^0.18.3",
51+
"@sistent/sistent": "^0.18.8",
5252
"@svgr/webpack": "^8.0.1",
5353
"axios": "^1.13.2",
5454
"babel-plugin-styled-components": "^2.1.4",

src/collections/members/bhumika-garg/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ bio: |
1010
Hi, I’m Bhumika Garg, passionate about open-source and cloud-native technologies. My journey with Meshery and the Layer5 community has strengthened my interest in Kubernetes and platform engineering.
1111
Since joining the community, I’ve been contributing to UI improvements and design system enhancements, collaborating with developers worldwide to build better cloud-native experiences. I enjoy creating intuitive and scalable interfaces that simplify complex workflows for developers.
1212
Through open-source collaboration, I continue to learn, grow, and contribute toward building impactful, community-driven solutions.
13+
badges:
14+
- community
1315
status: Active
1416
published: true
1517
---

src/collections/members/kavitha-karunakaran/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ layer5: 553a1e19-c2c3-4047-a461-68e98fe93fba
99
location: Bengaluru, Karnataka, India
1010
bio: "Software engineer with 15+ years of experience designing resilient, high-scale backend and infrastructure systems."
1111
status: Active
12+
badges:
13+
- community
1214
published: true
1315
---
1416

src/collections/members/yash-mahakal/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ location: Pune , India
1010
bio: "I’m a Computer Engineering student passionate about DevOps and cloud-native technologies, with a strong focus on containerization and infrastructure automation. I enjoy building scalable, production-ready systems using Docker, Kubernetes, Terraform, and AWS. My interests include distributed systems, CI/CD, and designing reliable cloud architectures. As a community speaker, I enjoy sharing insights and learning alongside the ecosystem. My journey with Meshery has been incredibly rewarding, giving me meaningful opportunities to contribute to open source, collaborate globally, and grow both technically and professionally."
1111
status: Active
1212
badges:
13-
- meshery
13+
- community
1414
published: true
1515
---

0 commit comments

Comments
 (0)