@@ -136,6 +136,9 @@ describe("GitHub Actions hardening", () => {
136136 expect ( workflow ) . toContain ( "bun scripts/release-notes.ts assemble" ) ;
137137 expect ( workflow ) . toContain ( "bun scripts/release-notes.ts matching-preview-tags" ) ;
138138 expect ( workflow ) . toContain ( "bun scripts/release-notes.ts has-meaningful" ) ;
139+ expect ( workflow ) . toContain ( "bun scripts/release-notes.ts join-carried" ) ;
140+ expect ( workflow ) . toContain ( "releases/tags/" ) ;
141+ expect ( workflow ) . toContain ( 'gh api "repos/${GITHUB_REPOSITORY}" --jq \'.full_name\'' ) ;
139142 expect ( workflow ) . toContain ( "git merge-base --is-ancestor" ) ;
140143 expect ( workflow ) . toContain ( "operational error, not a missing release" ) ;
141144 expect ( workflow ) . toContain ( "not an ancestor" ) ;
@@ -144,28 +147,41 @@ describe("GitHub Actions hardening", () => {
144147 expect ( workflow ) . toContain ( "--commits" ) ;
145148 expect ( workflow ) . toContain ( 'git tag --list "v${RELEASE_VERSION}-preview.*"' ) ;
146149 expect ( workflow ) . toContain ( "Carrying preview release notes from" ) ;
150+ // Every subcommand the workflow invokes must be dispatched by the CLI.
147151 const releaseNotesHelper = await readText ( "scripts/release-notes.ts" ) ;
148- expect ( releaseNotesHelper ) . toContain ( "## Commits" ) ;
149- expect ( releaseNotesHelper ) . toContain ( "## Since preview" ) ;
150- expect ( releaseNotesHelper ) . toContain ( "matchingPreviewTags" ) ;
151- expect ( releaseNotesHelper ) . toContain ( "hasMeaningfulCarriedNotes" ) ;
152- expect ( releaseNotesHelper ) . toContain ( "selectNewestCarriedPreviewTag" ) ;
152+ const invoked = [ ...workflow . matchAll ( / b u n s c r i p t s \/ r e l e a s e - n o t e s \. t s ( [ a - z - ] + ) / g) ]
153+ . map ( m => m [ 1 ] ! ) ;
154+ expect ( invoked . length ) . toBeGreaterThan ( 0 ) ;
155+ for ( const cmd of new Set ( invoked ) ) {
156+ expect ( releaseNotesHelper ) . toContain ( `"${ cmd } "` ) ;
157+ }
153158 expect ( workflow ) . toMatch ( / g h r e l e a s e c r e a t e [ \s \S ] * ?- - n o t e s - f i l e " \$ n o t e s _ f i l e " / ) ;
154159 expect ( workflow ) . not . toContain ( "gh release edit" ) ;
155160 expect ( workflow ) . not . toContain ( "--generate-notes" ) ;
156161 // Notes must be assembled before tagging so a notes API failure does not leave
157162 // a remote tag that blocks release retries at preflight.
158163 const createStep = workflow . split ( "- name: Create GitHub release" ) [ 1 ] ! . split ( / \n { 6 } - n a m e : / ) [ 0 ] ! ;
159- // Fail closed when generate-notes fails (no soft skip on the API call itself).
160- expect ( createStep ) . not . toMatch ( / p r _ n o t e s = " \$ \( g h a p i [ \s \S ] * ?\| \| t r u e \) " / ) ;
164+ // Preview carry lookup must use tag-specific API status, not `gh release view` stderr prose.
165+ expect ( createStep ) . toContain ( "releases/tags/" ) ;
166+ expect ( createStep ) . not . toContain ( "gh release view" ) ;
167+ // Fail closed: no soft-skip in any spelling around gh api calls in this step.
168+ for ( const line of createStep . split ( "\n" ) . filter ( l => l . includes ( "gh api" ) ) ) {
169+ expect ( line ) . not . toMatch ( / \| \| \s * ( t r u e | e c h o | : ) / ) ;
170+ }
171+ expect ( createStep ) . not . toContain ( "set +e\n pr_notes" ) ;
161172 expect ( createStep . indexOf ( "gh api" ) ) . toBeGreaterThan ( - 1 ) ;
162173 expect ( createStep . indexOf ( 'git tag "$release_tag"' ) ) . toBeGreaterThan ( - 1 ) ;
163174 expect ( createStep . indexOf ( "gh api" ) ) . toBeLessThan ( createStep . indexOf ( 'git tag "$release_tag"' ) ) ;
164175 // First-channel releases must not call generate-notes without an explicit baseline
165176 // (GitHub would otherwise pick the newest repo tag, possibly from the other channel).
166- expect ( createStep ) . toMatch (
167- / i f \[ - n " \$ n o t e s _ r a n g e _ s t a r t " \] ; t h e n [ \s \S ] * p r e v i o u s _ t a g _ n a m e = \$ \{ n o t e s _ r a n g e _ s t a r t \} [ \s \S ] * e l s e [ \s \S ] * s k i p p i n g g e n e r a t e - n o t e s / ,
168- ) ;
177+ // Scope to the single if-block that owns generate-notes; createStep has two
178+ // `[ -n "$notes_range_start" ]` blocks, so an unanchored [\s\S]* can straddle them.
179+ const notesBlock = createStep
180+ . split ( / i f \[ - n " \$ n o t e s _ r a n g e _ s t a r t " \] ; t h e n / ) [ 1 ] !
181+ . split ( / \n { 10 } i f \[ / ) [ 0 ] ! ;
182+ expect ( notesBlock ) . toContain ( "previous_tag_name=${notes_range_start}" ) ;
183+ expect ( notesBlock ) . toContain ( "skipping generate-notes" ) ;
184+ expect ( notesBlock ) . toMatch ( / \n { 10 } e l s e \n / ) ;
169185 } ) ;
170186
171187 test ( "docs deployment is pinned, bounded, and scoped to Pages" , async ( ) => {
0 commit comments