Skip to content

Improve media content generation with subagents #177

Improve media content generation with subagents

Improve media content generation with subagents #177

name: PR Demo Preview Comment
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
permissions:
pull-requests: write
contents: read
jobs:
comment:
name: Add Demo Preview Comment
runs-on: ubuntu-latest
steps:
- name: Comment on PR with demo info
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const prNumber = context.issue.number;
const comment = `## πŸš€ PR Preview Deployment
βœ… Your changes are being built and deployed to a preview environment.
**πŸ“‹ Live PR Preview Links:**
- 🌐 [DITA WebHelp Preview](https://${owner}.github.io/${repo}/pr-${prNumber}/)
- πŸ“š [Storybook Preview](https://${owner}.github.io/${repo}/pr-${prNumber}/storybook/)
**ℹ️ About PR Previews:**
- Preview deploys automatically when you push commits to this PR
- Preview URL is unique to this PR (#${prNumber})
- Preview will be automatically deleted when this PR is closed/merged
- Build ignores test failures (only requires successful compilation)
**πŸ“¦ Production Demo (main branch):**
- 🏠 [Quiz Index (Home)](https://${owner}.github.io/${repo}/main/quiz-index.html)
- πŸ“ [Quiz Examples](https://${owner}.github.io/${repo}/main/quiz-examples.html)
- πŸ“Š [Analysis Examples](https://${owner}.github.io/${repo}/main/analysis-examples.html)
**πŸ§ͺ Testing Locally:**
\`\`\`bash
npm install
npm run build
# Open demo/quiz-index.html in your browser (use file:// or http-server)
\`\`\`
---
*This comment will be automatically updated when you push new commits.*`;
// Check if we've already commented
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: prNumber,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('PR Preview Deployment')
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner,
repo,
comment_id: botComment.id,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: comment
});
}