Skip to content

feat(astro): deploy live demo to GitHub Pages with iframe bridge - #45

Open
PaarthPandey10 wants to merge 1 commit into
gemaraproj:mainfrom
PaarthPandey10:feat/host-gh-pages
Open

PaarthPandey10 wants to merge 1 commit into
gemaraproj:mainfrom
PaarthPandey10:feat/host-gh-pages

Conversation

@PaarthPandey10

Copy link
Copy Markdown

Related to gemaraproj/website#6 and gemaraproj/website#52

Summary

Configures the examples/astro showcase for GitHub Pages deployment (https://gemaraproj.github.io/gemara-react/) and adds a lightweight postMessage bridge so it can be embedded directly in the documentation website (gemaraproj/website#52) without adding a Node toolchain to the website repo.

Changes

  • examples/astro/astro.config.mjs: Set site: "https://gemaraproj.github.io" and base: "/gemara-react/" so static asset paths resolve cleanly on GitHub Pages.
  • examples/astro/src/pages/index.astro:
    • Added light/dark theme styling for the data-gemara-* attribute contract matching the Gemara documentation site palette.
    • Added a postMessage bridge that emits gemara-ready on load, posts gemara-resize updates via ResizeObserver, and listens for gemara-theme (light / dark) from the parent documentation page.
  • examples/astro/package.json: Made the a11y script cross-platform so pa11y-ci runs on both Linux and Windows.
  • .github/workflows/pages.yml: Added a GitHub Pages deployment workflow that checks out the sibling gemara spec test fixtures, builds @gemara/react, builds examples/astro, and deploys examples/astro/dist to GitHub Pages on pushes to main.

@PaarthPandey10
PaarthPandey10 requested a review from a team as a code owner November 5, 2026 06:31
Copilot AI balanced review requested due to automatic review settings November 5, 2026 06:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@kusari-inspector

kusari-inspector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Kusari Inspector

Kusari Analysis Results:

Proceed with these changes

✅ No Flagged Issues Detected
All values appear to be within acceptable risk parameters.

No pinned version dependency changes, code issues or exposed secrets detected!

Note

View full detailed analysis result for more information on the output and the checks that were run.


@kusari-inspector rerun - Trigger a re-analysis of this PR
@kusari-inspector feedback [your message] - Send feedback to our AI and team
See Kusari's documentation for setup and configuration.
Commit: 052b739, performed at: 2026-11-05T07:08:57Z

Found this helpful? Give it a 👍 or 👎 reaction!

Comment thread .github/workflows/pages.yml Outdated

permissions:
contents: read
pages: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: pages: write is granted at workflow level, so the build job gets it too even though only the deploy job needs it. Keep the top-level permissions at contents: read and move pages: write to the deploy job.

Recommended Code Changes:

permissions:
  contents: read

jobs:
  deploy:
    permissions:
      pages: write
      id-token: write

Comment thread .github/workflows/pages.yml Outdated
permissions:
contents: read
pages: write
id-token: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: id-token: write is granted at workflow level, so the build job, which runs npm install and build scripts, can mint OIDC tokens. Scope it to the deploy job only.

Recommended Code Changes:

permissions:
  contents: read

jobs:
  deploy:
    permissions:
      pages: write
      id-token: write

Comment thread .github/workflows/pages.yml Outdated
runs-on: ubuntu-latest
steps:
- name: Checkout gemara-react
uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA instead of the mutable v4 tag. Also set persist-credentials: false so the GITHUB_TOKEN is not left in .git/config while later npm scripts run.

Recommended Code Changes:

uses: actions/checkout@<full-commit-SHA> # v4
with:
  path: gemara-react
  persist-credentials: false

Comment thread .github/workflows/pages.yml Outdated
run: echo "ref=$(cat .spec-version)" >> "$GITHUB_OUTPUT"

- name: Checkout gemara fixtures
uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA and set persist-credentials: false. This checkout only needs read access to fixtures.

Recommended Code Changes:

uses: actions/checkout@<full-commit-SHA> # v4
with:
  repository: gemaraproj/gemara
  ref: ${{ steps.spec.outputs.ref }}
  path: gemara
  persist-credentials: false

Comment thread .github/workflows/pages.yml Outdated
path: gemara

- name: Setup Node
uses: actions/setup-node@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA instead of the mutable v4 tag.

Recommended Code Changes:

uses: actions/setup-node@<full-commit-SHA> # v4

Comment thread .github/workflows/pages.yml Outdated
run: npm run build

- name: Setup Pages
uses: actions/configure-pages@v5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA instead of the mutable v5 tag.

Recommended Code Changes:

uses: actions/configure-pages@<full-commit-SHA> # v5

Comment thread .github/workflows/pages.yml Outdated
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA instead of the mutable v3 tag.

Recommended Code Changes:

uses: actions/upload-pages-artifact@<full-commit-SHA> # v3

Comment thread .github/workflows/pages.yml Outdated
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: Pin this action to a full commit SHA. This job holds pages: write and id-token: write, so a compromised tag here is high impact.

Recommended Code Changes:

uses: actions/deploy-pages@<full-commit-SHA> # v4

Signed-off-by: PaarthPandey10 <paarthdxb@gmail.com>
@kusari-inspector

Copy link
Copy Markdown

Kusari PR Analysis rerun based on - 052b739 performed at: 2026-11-05T07:08:58Z - link to updated analysis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants