ci(preview): preview-link PR comments — survive re-deploys, report deploy metadata #17
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/preview-comment"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Brings the
<!-- preview-link -->PR comment feature onto the foundation line — rebased from the originalef5403a/74eaea7, then reworked after live verification exposed real bugs (2ad80d7).The feature
After each preview deploy, one marker comment is upserted on the PR (POST first, PATCH on re-deploys — never spams). Teardown PATCHes it to "removed" so closed PRs carry no dead link. Best-effort: API failure →
::warning::, never fails the job.The comment reports:
npm install)hfhardlink = unchanged, excluded)Bugs found & fixed during verification
github.event.pull_requestis empty onpushevents, soPR_NUMBER/HEAD_SHAwere blank.metanow resolves + outputs the PR number (jq lookup on open PRs); comment steps consume it either way.numfmtrejects negative deltas as options —human()now passes--(caught live: the ▼ line rendered empty).[ -z ] && { exit 0; }foot-gun — now anif.Verified on the runner host (katelyn)
GITHUB_API_URLincludes/api/v1— confirmed via throwaway probe run #276)hfexcluded, changed/new/deleted counted)bash -nUpsert a marker comment (<!-- preview-link -->) via GITHUB_TOKEN after deploy — POST first, PATCH on re-deploys (one comment per PR, no spam). Teardown PATCHes it to 'removed' so closed PRs keep no dead link. Both steps are best-effort (:⚠️: on API failure, never fail the job).🪦 Live preview
removed (PR closed)