@@ -594,9 +594,14 @@ describe('ci workflows', () => {
594594 expect ( source ) . not . toContain ( 'NODE_AUTH_TOKEN:' )
595595 } )
596596
597- it ( 'requires an explicit same-commit release certificate run' , ( ) => {
598- const { source } = readWorkflow ( 'release.yml' )
597+ it ( 'requires a certificate only for explicit release publishing' , ( ) => {
598+ const { source, workflow } = readWorkflow ( 'release.yml' )
599+ const releaseSteps : Array < Record < string , any > > = workflow . jobs . release . steps
600+ const downloadStep = releaseSteps . find ( step => step . name === 'Download same-commit coverage certificate' )
601+ const validateStep = releaseSteps . find ( step => step . name === 'Validate release certificate' )
599602
603+ expect ( downloadStep . if ) . toBe ( "inputs.mode == 'publish' || inputs.mode == 'publish-unpublished'" )
604+ expect ( validateStep . if ) . toBe ( "inputs.mode == 'publish' || inputs.mode == 'publish-unpublished'" )
600605 expect ( source ) . toContain ( 'RELEASE_CERTIFICATE_RUN_ID: ${{ vars.RELEASE_CERTIFICATE_RUN_ID }}' )
601606 expect ( source ) . toContain ( 'Release certificate is not configured' )
602607 expect ( source ) . toContain ( 'gh run view "$run_id" --json headSha,status,conclusion' )
@@ -653,6 +658,26 @@ describe('ci workflows', () => {
653658 } ) ) . toBe ( true )
654659 } )
655660
661+ it ( 'grants the PR benchmark reporter permission to publish pull request comments' , ( ) => {
662+ const { source, workflow } = readWorkflow ( 'benchmark-pr-report.yml' )
663+ const commentStep = workflow . jobs . publish . steps . find ( ( step : Record < string , unknown > ) => {
664+ return step . name === 'Update PR comment'
665+ } )
666+
667+ expect ( workflow . permissions ) . toMatchObject ( {
668+ actions : 'read' ,
669+ contents : 'read' ,
670+ 'pull-requests' : 'write' ,
671+ } )
672+ expect ( workflow . permissions . issues ) . toBeUndefined ( )
673+ expect ( commentStep ) . toMatchObject ( {
674+ uses : 'actions/github-script@v7' ,
675+ } )
676+ expect ( String ( commentStep . if ) ) . toContain ( "steps.report.outcome == 'success'" )
677+ expect ( commentStep [ 'continue-on-error' ] ) . not . toBe ( true )
678+ expect ( source ) . toContain ( 'github.rest.issues.createComment' )
679+ } )
680+
656681 it ( 'delegates the complete package lifecycle to repoctl' , ( ) => {
657682 const { source, workflow } = readWorkflow ( 'release.yml' )
658683 const { workflow : releaseGateWorkflow } = readWorkflow ( 'release-gate.yml' )
0 commit comments