Skip to content

Comment the preview link when the pull request opens - #13

Merged
lmoresi merged 5 commits into
mainfrom
fix/preview-link-on-open
Aug 13, 2026
Merged

Comment the preview link when the pull request opens#13
lmoresi merged 5 commits into
mainfrom
fix/preview-link-on-open

Conversation

@lmoresi

@lmoresi lmoresi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Follow-on to #10, which had already merged when this was written — a merged pull request cannot be reopened, so this is the remainder on its own branch. Everything else from #10 (the PDF artifact, the preview skip for deposit branches, the unrecorded-identifiers guard) is already in main; only this was left behind.

The notification is the preview. The preview directory is a hash of the branch name and nothing links to it, so a missing comment means an unreachable preview.

Two defects.

preview.yml comments on push, and only if a pull request already exists for the branch. Push, then open the pull request — the natural order, and the one the worktree flow encourages — and the comment step correctly finds nothing and exits. The preview is built and serving the whole time. That happened to UWTN 2026-012 (#11) and was recovered by computing the URL by hand.

New preview-link.yml fires on pull_request: [opened, reopened] and comments the link without rebuilding. It reads the same URL, confirms it is really serving before saying anything, and stays silent if it is not, leaving the push-triggered run to comment when its build lands. It imports preview_mark.preview_path rather than reimplementing the hash — verified to return 0609b3b0c4, the directory actually serving #11 — and reads head.ref rather than GITHUB_REF_NAME, which on a pull_request event is <number>/merge and would key the URL to a directory that does not exist.

The dedupe never worked. It matched a body starting **Preview:**, while the variant that carries links starts **Preview with no colon — so the common case matched nothing and every push appended another comment. PR #7 has thirteen. Both workflows now match the prefix the two variants share.

Underworld development team with AI support from Claude Code

…ating it

Two defects in how the preview gets announced. The link is the only way to
reach a preview -- the directory is a hash of the branch name and nothing links
to it -- so a missing notification is a missing preview.

FIRST: preview.yml comments on PUSH, and only if a pull request already exists
for the branch. Push, then open the pull request -- the natural order, and the
one the worktree flow encourages -- and the comment step correctly finds no
pull request and exits. The preview is built and serving the whole time. That
happened to UWTN 2026-012 and had to be recovered by computing the URL by hand.

preview-link.yml now fires on pull_request opened/reopened and comments the
link WITHOUT rebuilding: it reads the same URL, confirms it is really serving
first, and says nothing if it is not, leaving the push-triggered run to comment
when its build lands. It takes the path from preview_mark.preview_path rather
than reimplementing the hash, and reads head.ref rather than GITHUB_REF_NAME,
which on a pull_request event is "<number>/merge" and would key the URL to the
wrong directory.

SECOND: the dedupe never matched. It looked for a body starting "**Preview:**"
while the variant that carries links starts "**Preview" with no colon -- so the
common case matched nothing and every push appended another comment. PR #7 has
thirteen. Both workflows now match on the prefix both variants share.

Underworld development team with AI support from Claude Code
Louis: 'It's odd that there is a preview action that holds up merging 13 and 12
when those have nothing to preview.'

It was not actually holding anything up -- only `test` is a required check, so
those merge whatever preview is doing -- but spending six minutes republishing
an unchanged site for a branch that touches workflows and tests is waste, and
it makes the checks list look like it is blocking when it is not.

The push trigger now filters on the paths that change what a reader sees.
scripts/ is in the list deliberately: those build the site, so a change there
can alter every page without touching an article.

Safe as a paths filter ONLY because preview is not required. A required check
skipped this way stays 'expected' and blocks the merge forever rather than
passing, so the test says so next to the assertion.

Underworld development team with AI support from Claude Code
The deposit-preview test pinned 'paths-ignore' as the way a deposit-queue
branch is kept out of the preview. Replacing it with a positive paths list --
which excludes deposit-queue.txt more strongly, by not naming it -- made that
test fail on a change that improved the thing it guards.

Also: I committed the previous change with that test failing, because the
command piped pytest into tail and the pipe's exit status masked pytest's.
Second time this session. Run it, check $?, then commit.
@github-actions

Copy link
Copy Markdown
Contributor

Preview: https://underworld-technical-notes.github.io/underworldcode.org-preview/8c5bf9f2bc/

No article changed on this branch. Built from 1a04bb8. Shows notes at draft and review, which the published site withholds. Not indexed, no comments, and not the citable version.

@lmoresi
lmoresi merged commit 3498497 into main Aug 13, 2026
1 check passed
@lmoresi
lmoresi deleted the fix/preview-link-on-open branch August 13, 2026 10:11
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.

1 participant