feat: Host index.html Demo on GitHub Pages#37
feat: Host index.html Demo on GitHub Pages#37DebuggingMax wants to merge 1 commit intoAOSSIE-Org:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow to build and deploy the repository root (demo Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant GH as GitHub (repo)
participant Runner as Actions Runner
participant Pages as GitHub Pages
Dev->>GH: push to main / manual dispatch
GH->>Runner: trigger workflow (deploy-pages.yml)
Runner->>GH: actions/checkout (get repo files)
Runner->>Runner: actions/configure-pages (prepare deployment)
Runner->>Runner: actions/upload-pages-artifact (package `.`)
Runner->>Pages: actions/deploy-pages (publish artifact)
Pages-->>GH: deployment created (pages URL output)
GH-->>Dev: workflow completes (deployment URL)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/pages.yml (2)
6-9: Optional: Add path filters to avoid unnecessary deployments.Currently, any push to
maintriggers deployment, even for changes to files that don't affect the demo (e.g., CI workflows, documentation outside the demo). Consider adding path filters if you want to reduce unnecessary workflow runs.💡 Optional: Add path filters
on: # Runs on pushes targeting the default branch push: branches: ["main"] + paths: + - 'index.html' + - 'css/**' + - 'js/**' + - 'images/**' + # Add other demo-related paths as needed🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/pages.yml around lines 6 - 9, The push trigger currently uses only "on: push: branches: [\"main\"]" so every push to main runs the pages workflow; narrow this by adding path filters to the push trigger (use "paths:" to include only demo-related files or "paths-ignore:" to skip CI/docs) so unrelated changes don't trigger deploys—update the workflow trigger block (the on: push: branches: ["main"] section) to include an appropriate "paths" or "paths-ignore" list that matches your demo/source files.
37-41: Consider uploading only the demo files instead of the entire repository.Using
path: '.'uploads the entire repository including source files, workflow files, and other non-demo content. This works but increases artifact size and exposes all repository files on the Pages site.If only the demo files are needed, consider specifying a more targeted path or creating a dedicated
docs/ordemo/directory.💡 Optional: Upload specific files only
If you want to limit what gets deployed, you could either:
- Move demo files to a dedicated directory and update the path:
with: - # Upload entire repository - path: '.' + # Upload only demo directory + path: './demo'
- Or keep current setup if exposing the full repository is intentional for users to browse source files alongside the demo.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/pages.yml around lines 37 - 41, The Upload artifact step currently uses actions/upload-pages-artifact@v3 with path: '.' which uploads the whole repo; change the step so it only uploads your demo/site files—either move the demo to a dedicated directory (e.g., docs/ or demo/) and set the Upload artifact step’s path to that directory, or update the step to target only the specific demo build output (e.g., the static site output directory) instead of '.' to reduce artifact size and avoid exposing unrelated repo files; the step to edit is the job step named "Upload artifact" that uses actions/upload-pages-artifact@v3.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/pages.yml:
- Around line 6-9: The push trigger currently uses only "on: push: branches:
[\"main\"]" so every push to main runs the pages workflow; narrow this by adding
path filters to the push trigger (use "paths:" to include only demo-related
files or "paths-ignore:" to skip CI/docs) so unrelated changes don't trigger
deploys—update the workflow trigger block (the on: push: branches: ["main"]
section) to include an appropriate "paths" or "paths-ignore" list that matches
your demo/source files.
- Around line 37-41: The Upload artifact step currently uses
actions/upload-pages-artifact@v3 with path: '.' which uploads the whole repo;
change the step so it only uploads your demo/site files—either move the demo to
a dedicated directory (e.g., docs/ or demo/) and set the Upload artifact step’s
path to that directory, or update the step to target only the specific demo
build output (e.g., the static site output directory) instead of '.' to reduce
artifact size and avoid exposing unrelated repo files; the step to edit is the
job step named "Upload artifact" that uses actions/upload-pages-artifact@v3.
ed9005f to
007d407
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/deploy-pages.yml (1)
33-36: Scope the uploaded Pages artifact to demo assets only.
Line [36]currently uploads the full repo root. Prefer staging only the demo files to reduce accidental public surface and artifact bloat.Proposed refactor
+ - name: Prepare Pages artifact + run: | + mkdir -p _site + cp index.html _site/ + cp -R public _site/public + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: '.' + path: './_site'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/deploy-pages.yml around lines 33 - 36, The Upload artifact step (name: "Upload artifact", uses: actions/upload-pages-artifact@v3) is currently uploading the repo root (path: '.') — change the path input to only the demo/site build output directory (e.g. 'demo', 'demo/dist' or the actual demo build output) so only demo assets are staged; update the step's with.path value to that specific folder and verify the demo build step produces files there before upload.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/deploy-pages.yml:
- Around line 28-40: Replace the four mutable action refs (actions/checkout@v4,
actions/configure-pages@v5, actions/upload-pages-artifact@v3,
actions/deploy-pages@v4) with their corresponding immutable commit SHAs; locate
each `uses:` line in the workflow and update the ref after `@` to the exact
40-character commit SHA from the action's repository (e.g., the latest stable
commit for each action) so the workflow pins to specific commits rather than
version tags.
---
Nitpick comments:
In @.github/workflows/deploy-pages.yml:
- Around line 33-36: The Upload artifact step (name: "Upload artifact", uses:
actions/upload-pages-artifact@v3) is currently uploading the repo root (path:
'.') — change the path input to only the demo/site build output directory (e.g.
'demo', 'demo/dist' or the actual demo build output) so only demo assets are
staged; update the step's with.path value to that specific folder and verify the
demo build step produces files there before upload.
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: '.' | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
There was a problem hiding this comment.
Pin GitHub Actions to commit SHAs for supply-chain hardening.
At Line [28], Line [31], Line [34], and Line [40], version tags are mutable. Prefer SHA pinning to prevent unexpected action drift.
Use this check to find non-SHA-pinned actions across workflows (expected: no output after remediation):
#!/bin/bash
set -euo pipefail
rg -n --glob '.github/workflows/*.yml' --glob '.github/workflows/*.yaml' '^\s*uses:\s*[^@]+@[^[:space:]]+' \
| awk -F'@' '
{
ref=$2
if (ref !~ /^[0-9a-fA-F]{40}$/) print $0
}'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/deploy-pages.yml around lines 28 - 40, Replace the four
mutable action refs (actions/checkout@v4, actions/configure-pages@v5,
actions/upload-pages-artifact@v3, actions/deploy-pages@v4) with their
corresponding immutable commit SHAs; locate each `uses:` line in the workflow
and update the ref after `@` to the exact 40-character commit SHA from the
action's repository (e.g., the latest stable commit for each action) so the
workflow pins to specific commits rather than version tags.
- Add GitHub Actions workflow to deploy index.html to GitHub Pages - Update README with live demo link badge - Users can now preview the SocialShareButton without cloning the repo Fixes AOSSIE-Org#31
007d407 to
07a4224
Compare
Summary
This PR implements GitHub Pages hosting for the SocialShareButton demo as requested in #31.
Changes
.github/workflows/deploy-pages.yml- GitHub Actions workflow for automatic deploymentREADME.mdwith live demo badge and linkHow it works
mainbranch, the workflow automatically deploys the site to GitHub PagesSetup Required (After Merge)
The repository maintainer needs to:
Benefits
Closes #31
Summary by CodeRabbit
New Features
Documentation