@@ -5,41 +5,64 @@ import { join } from "node:path";
55import { fileURLToPath } from "node:url" ;
66
77const root = fileURLToPath ( new URL ( ".." , import . meta. url ) ) ;
8- const currentTag = "v0.1.0-beta.5" ;
9- const currentReleaseUrl = `https://github.com/daichunghy/patchgate/releases/tag/${ currentTag } ` ;
8+ const releaseDoc = readFileSync (
9+ join ( root , "docs/releases/beta-release-and-rollback.md" ) ,
10+ "utf8" ,
11+ ) ;
12+ const releaseMatch = releaseDoc . match (
13+ / \[ \` ( v \d + \. \d + \. \d + (?: - [ A - Z a - z 0 - 9 . ] + ) ? ) \` \] \( h t t p s : \/ \/ g i t h u b \. c o m \/ d a i c h u n g h y \/ p a t c h g a t e \/ r e l e a s e s \/ t a g \/ \1\) / ,
14+ ) ;
15+ const failures = [ ] ;
16+
17+ if ( ! releaseMatch ) {
18+ failures . push (
19+ "release runbook must link the current public release using a self-consistent tag and URL" ,
20+ ) ;
21+ }
22+
23+ const currentTag = releaseMatch ?. [ 1 ] ?? "" ;
24+ const currentReleaseUrl = currentTag
25+ ? `https://github.com/daichunghy/patchgate/releases/tag/${ currentTag } `
26+ : "" ;
27+ // The README is intentionally release-agnostic. Release assertions belong in
28+ // the focused consumer and release runbooks so the front page can stay useful
29+ // between releases.
1030const surfaces = [
11- "README.md" ,
1231 "docs/github-action-usage.md" ,
1332 "docs/getting-started.md" ,
1433 "docs/releases/beta-release-and-rollback.md" ,
1534] ;
16- const failures = [ ] ;
1735
1836for ( const relativePath of surfaces ) {
1937 const text = readFileSync ( join ( root , relativePath ) , "utf8" ) ;
20- if ( ! text . includes ( currentTag ) ) failures . push ( `${ relativePath } must name ${ currentTag } ` ) ;
21- if ( ! text . includes ( currentReleaseUrl ) ) failures . push ( `${ relativePath } must link the ${ currentTag } release` ) ;
38+ if ( currentTag && ! text . includes ( currentTag ) ) {
39+ failures . push ( `${ relativePath } must name ${ currentTag } ` ) ;
40+ }
41+ if ( currentReleaseUrl && ! text . includes ( currentReleaseUrl ) ) {
42+ failures . push ( `${ relativePath } must link the ${ currentTag } release` ) ;
43+ }
2244}
2345
2446const usage = readFileSync ( join ( root , "docs/github-action-usage.md" ) , "utf8" ) ;
25- if ( ! usage . includes ( `uses: daichunghy/patchgate@${ currentTag } ` ) ) {
26- failures . push ( "docs/github-action-usage.md must pin the current beta in consumer examples" ) ;
47+ if ( currentTag && ! usage . includes ( `uses: daichunghy/patchgate@${ currentTag } ` ) ) {
48+ failures . push (
49+ "docs/github-action-usage.md must pin the current public release in consumer examples" ,
50+ ) ;
2751}
2852if ( usage . includes ( "beta.2 posts a Check Run" ) ) {
2953 failures . push ( "docs/github-action-usage.md contains the stale beta.2 Check Run claim" ) ;
3054}
31- if ( ! usage . includes ( "snapshot-rejection Check Runs are included in beta.5" ) ) {
32- failures . push ( "docs/github-action-usage.md must state the current snapshot-rejection Check Run behavior" ) ;
33- }
34-
35- const readme = readFileSync ( join ( root , "README.md" ) , "utf8" ) ;
36- if ( readme . includes ( "uses: daichunghy/patchgate@v0.1.0-beta.2" ) ) {
37- failures . push ( "README.md must not teach the superseded beta.2 Action reference" ) ;
55+ if ( ! usage . includes ( "snapshot-rejection Check Runs are included in the public beta" ) ) {
56+ failures . push (
57+ "docs/github-action-usage.md must describe snapshot-rejection Check Run behavior without a release-specific claim" ,
58+ ) ;
3859}
3960
4061if ( failures . length > 0 ) {
41- process . stderr . write ( `consumer documentation check failed:\n${ failures . join ( "\n" ) } \n` ) ;
62+ process . stderr . write ( `consumer documentation check failed:\\ n${ failures . join ( "\\ n" ) } \ \n` ) ;
4263 process . exit ( 1 ) ;
4364}
4465
45- process . stdout . write ( `consumer documentation check passed: ${ surfaces . length } public surfaces reference ${ currentTag } \n` ) ;
66+ process . stdout . write (
67+ `consumer documentation check passed: ${ surfaces . length } focused public surfaces follow the canonical release runbook\\n` ,
68+ ) ;
0 commit comments