@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest'
44import { parse } from 'yaml'
55
66interface ReleaseStep {
7+ env ?: Record < string , string >
78 name ?: string
89 run ?: string
910 uses ?: string
@@ -12,6 +13,7 @@ interface ReleaseStep {
1213interface ReleaseWorkflow {
1314 concurrency : { group : string ; 'cancel-in-progress' : boolean }
1415 jobs : {
16+ land : { steps : ReleaseStep [ ] }
1517 verify : {
1618 environment ?: string
1719 outputs : { sha : string }
@@ -36,6 +38,19 @@ const workflow = parse(
3638) as ReleaseWorkflow
3739
3840describe ( 'v1 release workflow contract' , ( ) => {
41+ it ( 'scopes both release App tokens to the current repository' , ( ) => {
42+ const mintSteps = Object . values ( workflow . jobs )
43+ . flatMap ( job => job . steps )
44+ . filter ( step => step . run === 'node scripts/release/mint-app-token.mjs' )
45+ expect ( mintSteps ) . toHaveLength ( 2 )
46+ for ( const step of mintSteps ) {
47+ expect ( step . env ) . toMatchObject ( {
48+ PERMISSIONS : '{"contents":"write"}' ,
49+ REPOSITORIES : '${{ github.event.repository.name }}' ,
50+ } )
51+ }
52+ } )
53+
3954 it ( 'uses the migrated trusted publisher environment' , ( ) => {
4055 expect ( workflow . jobs . publish . environment ) . toBe ( 'publish-npm' )
4156 expect ( workflow . jobs . publish . permissions [ 'id-token' ] ) . toBe ( 'write' )
0 commit comments