Skip to content

Add PR preview in CI for easier review #19

Merged
ncclementi merged 3 commits into
mainfrom
add-preview-in-ci-test
Feb 25, 2026
Merged

Add PR preview in CI for easier review #19
ncclementi merged 3 commits into
mainfrom
add-preview-in-ci-test

Conversation

@ncclementi

@ncclementi ncclementi commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

So this PR includes a generated preview of the site that is built based on the PR. That way it'll be easier to review in the future. It only works from branches PRs, if the PR comes from a fork, it skips the workflow because it's not possible to run it due to security (the GHA does not work, so to avoid the error we skip it directly.

A maintainer will have to run from local. I added this into the CONTRIBUTING.md.

  • For some reason (I think it might be a DNS thing, but I'm not sure). Even though the action creates a https preview link, when opening, it shows as http and it says not secure, it's unclear why to me.

  • Note: There were some hard-coded paths, that were breaking being able to render well the preview. Claude suggested using relative paths, and that worked.

Some of the changes needed to make this work:

┌────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐                                              
  │          File          │                                       Fix                                       │                                              
  ├────────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤                                              
  │ _layouts/homepage.html │ Logo src, event.image src, event-interest-form link, /blog/ link, /donate/ link │                                              
  ├────────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
  │ _layouts/donate.html   │ Logo src                                                                        │                                              
  ├────────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤                                              
  │ _includes/header.html  │ Logo src                                                                        │
  ├────────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤                                              
  │ _includes/footer.html  │ Root href="/", /donate/ link                                                    │                                              
  ├────────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤                                              
  │ community.markdown     │ Event-interest-form link                                                        │
  └────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘

Every hardcoded /path is now wrapped with {{ '...' | relative_url }}, so they'll respect baseurl in both production and previews. The data file paths in
_data/event_highlights.yml are handled at the template level (the {{ event.image | relative_url }} fix in homepage.html), so they don't need to change.

{{ '...' | relative_url }}

In Jekyll's Liquid templating language:

  • {{ }} — outputs a value into the HTML
  • '...' — a string literal (the path you're providing)
  • | — a pipe that passes the value on the left into a filter on the right
  • relative_url — a Jekyll filter that prepends site.baseurl to the path

So {{ '/blog/' | relative_url }} works like this:

  • When baseurl: "" (production): outputs /blog/
  • When baseurl: "/pr-preview/pr-17" (preview): outputs /pr-preview/pr-17/blog/

For the data file case, {{ event.image | relative_url }} does the same thing but reads the path from a variable instead of a string literal.

@github-actions

github-actions Bot commented Feb 24, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-02-25 15:05 UTC

@ncclementi ncclementi changed the title Add preview in ci test [WIP] Add preview in ci test Feb 24, 2026
@ncclementi ncclementi changed the title [WIP] Add preview in ci test Add PR preview in CI for easier review Feb 24, 2026
@ncclementi ncclementi force-pushed the add-preview-in-ci-test branch from b950903 to 3842f44 Compare February 24, 2026 03:17
@camclay

camclay commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

LGTM Approved!

@ncclementi ncclementi merged commit f56b8fe into main Feb 25, 2026
1 check passed
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