@@ -1328,6 +1328,7 @@ function runGeneratedPublisherScenario(
13281328 existingPr ?: boolean ;
13291329 expectFailure ?: boolean ;
13301330 failGeneratedPush ?: boolean ;
1331+ invalidationPaths ?: string ;
13311332 mergeGeneratedPush ?: boolean ;
13321333 noGeneratedChange ?: boolean ;
13331334 overlapPolicy ?: string ;
@@ -1495,7 +1496,7 @@ ${actionRun}`;
14951496 FAKE_STALE_HEAD_ONCE : stalePrHeadOnce ,
14961497 FAKE_STALE_PR_VIEW_HEAD_ONCE : stalePrViewHeadOnce ,
14971498 GENERATED_PATHS : "generated" ,
1498- INVALIDATION_PATHS : "source" ,
1499+ INVALIDATION_PATHS : options . invalidationPaths ?? "source" ,
14991500 OVERLAP_POLICY : options . overlapPolicy ?? "defer" ,
15001501 CONTENTS_TOKEN : "contents-token" ,
15011502 GH_TOKEN : "test-token" ,
@@ -2394,6 +2395,11 @@ NODE
23942395 expect ( actionPublishStep . env . CONTENTS_TOKEN ) . toBe ( "${{ steps.tokens.outputs.contents-token }}" ) ;
23952396 expect ( actionPublishStep . env . GH_TOKEN ) . toBe ( "${{ steps.tokens.outputs.pull-request-token }}" ) ;
23962397 expect ( actionPublishStep . env . INVALIDATION_PATHS ) . toBe ( "${{ inputs.invalidation-paths }}" ) ;
2398+ expect ( publishAction . inputs [ "invalidation-paths" ] ) . toEqual ( {
2399+ description : "Newline-delimited generator input paths that make an older run stale." ,
2400+ required : false ,
2401+ default : "" ,
2402+ } ) ;
23972403 expect ( publishAction . inputs [ "working-directory" ] ) . toEqual ( {
23982404 description : "Repository root containing the generated files." ,
23992405 required : false ,
@@ -2741,6 +2747,21 @@ NODE
27412747 } ,
27422748 ) ;
27432749
2750+ it . skipIf ( process . platform === "win32" ) (
2751+ "publishes after unrelated source changes when input invalidation is disabled" ,
2752+ ( ) => {
2753+ const result = runGeneratedPublisherScenario ( null , {
2754+ invalidationPaths : "" ,
2755+ overlapPolicy : "fail" ,
2756+ updateSource : true ,
2757+ } ) ;
2758+
2759+ expect ( result . branchExists ) . toBe ( true ) ;
2760+ expect ( result . generatedA ) . toBe ( "desired-a" ) ;
2761+ expect ( result . publishOutput ) . not . toContain ( "Refusing stale generated output" ) ;
2762+ } ,
2763+ ) ;
2764+
27442765 it . skipIf ( process . platform === "win32" ) (
27452766 "neutralizes an existing pull request when generation has no changes" ,
27462767 ( ) => {
@@ -9028,6 +9049,7 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
90289049
90299050 expect ( publishPrJob . needs ) . toEqual ( [ "validate_selected_ref" , "publisher_preflight" , "publish" ] ) ;
90309051 expect ( publishPrJob [ "runs-on" ] ) . toBe ( "ubuntu-24.04" ) ;
9052+ expect ( publishPrJob . permissions ) . toEqual ( { actions : "read" , contents : "read" } ) ;
90319053 for ( const fragment of [
90329054 "needs.publisher_preflight.result == 'success'" ,
90339055 "needs.publish.result == 'success'" ,
@@ -9084,17 +9106,12 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
90849106 "working-directory" : "selected" ,
90859107 "commit-message" : "docs: update maturity scorecard" ,
90869108 "pr-title" : "docs: update maturity scorecard" ,
9109+ "invalidation-paths" : "" ,
90879110 "overlap-policy" : "fail" ,
90889111 } ) ;
90899112 expect ( openDocsPrStep . with [ "generated-paths" ] . trim ( ) . split ( "\n" ) ) . toEqual (
90909113 MATURITY_GENERATED_PR_PATHS ,
90919114 ) ;
9092- expect ( openDocsPrStep . with [ "invalidation-paths" ] . trim ( ) . split ( "\n" ) ) . toEqual ( [
9093- "." ,
9094- ":(exclude)qa/maturity-scores.yaml" ,
9095- ":(exclude)docs/maturity/scorecard.md" ,
9096- ":(exclude)docs/maturity/taxonomy.md" ,
9097- ] ) ;
90989115 for ( const heading of [
90999116 "## What Problem This Solves" ,
91009117 "## Why This Change Was Made" ,
0 commit comments