Skip to content

feat: add relative timestamps to preview deploy comments#98

Merged
cdtinney merged 2 commits into
mainfrom
cdtinney/pr-preview-timestamps
Apr 27, 2026
Merged

feat: add relative timestamps to preview deploy comments#98
cdtinney merged 2 commits into
mainfrom
cdtinney/pr-preview-timestamps

Conversation

@cdtinney

Copy link
Copy Markdown
Owner

Description

Adds a relative timestamp (e.g. just now, 5 min ago, 2 hr ago, 3 days ago) to each preview URL line in the Cloudflare Pages preview comment. Each entry now reads as URL (SHA) · relative-time.

The ISO timestamp is stored inline as a hidden HTML comment (<!-- ts:... -->) so it survives across comment updates. On every new deploy, all previous-preview relative times are recomputed from their stored ISO timestamps so they stay accurate as the PR progresses.

Testing

  • Ran script locally against a mocked existing comment with entries from 5 min, 1 hr, and 2 days ago — new entry rendered as just now and prior entries were re-rendered with correctly updated relative times while URLs/SHAs were preserved.
  • pnpm format:check, pnpm lint, pnpm typecheck pass.

@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

Preview deployment

https://6b994107.tinney-dev.pages.dev (f76d037) · now

Previous previews

- store sha in metadata comment instead of parsing markdown link out of regex
- cap previous-previews list at 10 entries to prevent unbounded growth
- use Intl.RelativeTimeFormat for relative time strings
- extract MARKER and MAX_PREVIOUS_ENTRIES constants
- defensive per_page: 100 on listComments
@cdtinney cdtinney force-pushed the cdtinney/pr-preview-timestamps branch from 4606bb2 to 775bac2 Compare April 27, 2026 17:20
@cdtinney cdtinney merged commit 93cf711 into main Apr 27, 2026
5 checks 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.

1 participant