Improve media content generation with subagents #177
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| }); | |
| } |