Skip to content

Commit b906554

Browse files
committed
fix: update PR preview comment logic to update existing comments
1 parent b6b6f3a commit b906554

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
- name: Install dependencies
5151
run: cd docs && npm ci
5252

53+
- name: Set base path for PR preview
54+
if: github.event_name == 'pull_request'
55+
run: echo "VITEPRESS_BASE_PATH=/Activities/pr-preview/${{ github.event.pull_request.number }}" >> $GITHUB_ENV
56+
5357
- name: Build with VitePress
5458
run: cd docs && npm run build
5559

@@ -92,7 +96,8 @@ jobs:
9296
with:
9397
github-token: ${{ secrets.GITHUB_TOKEN }}
9498
script: |
95-
const body = `## 📝 Documentation Preview\n\n**Your documentation changes are ready for preview!**\n\n🔍 [View Preview](${process.env.DEPLOYMENT_URL})\n\n_This preview will be automatically updated when you push new commits to this PR._`;
99+
const previewUrl = `${process.env.DEPLOYMENT_URL}/pr-preview/${context.issue.number}/`;
100+
const body = `## 📝 Documentation Preview\n\n**Your documentation changes are ready for preview!**\n\n🔍 [View Preview](${previewUrl})\n\n_This preview will be automatically updated when you push new commits to this PR._`;
96101
github.rest.issues.createComment({
97102
issue_number: context.issue.number,
98103
owner: context.repo.owner,

docs/.vitepress/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import process from 'node:process'
12
import { defineConfig } from 'vitepress'
23

34
// Define available versions
@@ -12,8 +13,11 @@ const versions: VersionItem[] = [
1213
{ text: 'v2 (Coming Soon)', link: '#', disabled: true },
1314
]
1415

16+
// Get base path from environment variable or use default
17+
const basePath = process.env.VITEPRESS_BASE_PATH || '/Activities'
18+
1519
export default defineConfig({
16-
base: '/Activities',
20+
base: basePath,
1721
title: 'PreMiD',
1822
description: 'Documentation for developing PreMiD Activities',
1923
themeConfig: {

0 commit comments

Comments
 (0)