Comment the preview link when the pull request opens - #13
Merged
Conversation
…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
…rld-Technical-Notes/underworldcode.org into fix/preview-link-on-open
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.
Contributor
|
Preview: https://underworld-technical-notes.github.io/underworldcode.org-preview/8c5bf9f2bc/ No article changed on this branch. Built from |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlcomments 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.ymlfires onpull_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 importspreview_mark.preview_pathrather than reimplementing the hash — verified to return0609b3b0c4, the directory actually serving #11 — and readshead.refrather thanGITHUB_REF_NAME, which on apull_requestevent is<number>/mergeand 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**Previewwith 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