Files
lobehub__lobehub/scripts/workerDeployAnnotations.test.ts
Innei 011f947cf7 👷 ci(share,workbench): upload PR previews to sibling -preview Workers (#19103)
* 👷 ci(share,workbench): upload PR previews to sibling -preview Workers

Cloudflare rolls back only to the 100 most recently uploaded versions of a
script, and PR preview uploads landed on the production scripts, so a busy
day pushed every real deployment out of the rollback window. Previews now
go to lobehub-share-preview and lobehub-workbench-preview; the preview
aliases move with them (pr<N>-lobehub-share-preview...).

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM

* 📝 docs(split-micro-app): previews upload to a sibling -preview Worker

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM

* 👷 ci(share,workbench): stamp actor, commit and run on every Worker version

Cloudflare records only the API token's owner as a version's author, so a
deploy from CI or a laptop was unattributable. wrangler deploy and PR preview
uploads now carry --tag <sha7> and --message "<actor> <repo>@<sha7> run <id>"
(local deploys: "<git email> local@<sha7>"), which 鳥居番's Deploys page
already shows per version.

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM

* 📝 docs(split-micro-app): 鳥居番 Deploys page has Releases and Previews tabs

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM

* 📝 docs(split-micro-app): releases and previews live on the target's Worker card

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM

* 📝 docs(split-micro-app): Set override writes the staging config directly

Claude-Session: https://claude.ai/code/session_01BKMAksDxdePWPW4kgr9KpM
2026-09-04 02:53:34 +08:00

33 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { workerDeployAnnotationArgs } from './workerDeployAnnotations';
describe('workerDeployAnnotationArgs', () => {
it('names the Actions actor, repo, commit and run so the Cloudflare record is self-describing', () => {
expect(
workerDeployAnnotationArgs({
GITHUB_ACTIONS: 'true',
GITHUB_ACTOR: 'octocat',
GITHUB_REPOSITORY: 'lobehub/lobehub',
GITHUB_RUN_ID: '123456',
GITHUB_SHA: 'abcdef1234567890',
}),
).toEqual([
'--tag',
'abcdef1',
'--message',
'octocat lobehub/lobehub@abcdef1 run 123456',
]);
});
it('falls back to the local operator and commit outside Actions', () => {
expect(
workerDeployAnnotationArgs({}, { email: 'dev@lobehub.com', sha: '0123456789abcdef' }),
).toEqual(['--tag', '0123456', '--message', 'dev@lobehub.com local@0123456']);
});
it('annotates nothing when neither source can name an operator', () => {
expect(workerDeployAnnotationArgs({}, undefined)).toEqual([]);
});
});