File tree Expand file tree Collapse file tree
.github/actions/Publish-PSModule/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -541,6 +541,31 @@ Describe 'Publish-PSModule source-bound preflight' {
541541 $script :state.GitHubWrites | Should - Be 0
542542 }
543543
544+ It ' rejects original event PR context before projection' - ForEach @ (
545+ @ { EventJson = ' {"pull_request":[{"number":42}]}' }
546+ @ { EventJson = ' {"pull_request":{"number":[42]}}' }
547+ @ { EventJson = ' [{"pull_request":{"number":42}}]' }
548+ @ { EventJson = ' {"pull_request":{}}' }
549+ ) {
550+ [IO.File ]::WriteAllText($env: GITHUB_EVENT_PATH , $EventJson )
551+
552+ { & $script :publishScriptPath 1> $null 6> $null } | Should - Throw ' *context*'
553+
554+ $script :state.GalleryWrites | Should - Be 0
555+ $script :state.GitHubWrites | Should - Be 0
556+ }
557+
558+ It ' retains the valid producing event PR number before projection' {
559+ [IO.File ]::WriteAllText($env: GITHUB_EVENT_PATH , ' {"pull_request":{"number":42}}' )
560+ $script :state.ExpectedClaim.PullRequest = 42
561+
562+ { & $script :publishScriptPath 1> $null 6> $null } | Should -Not - Throw
563+
564+ $script :state.GalleryWrites | Should - Be 1
565+ $claim = Get-PSModulePublicationClaim - Message $script :state.TagObject.message
566+ $claim.PullRequest | Should - Be 42
567+ }
568+
544569 It ' rejects a draft release before Gallery publication rather than reporting completed publication' {
545570 Set-PSModuleFixtureClaim - State $script :state - Claim $script :state.ExpectedClaim
546571 $script :state.Release = [pscustomobject ]@ {
You can’t perform that action at this time.
0 commit comments