File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ async function getGitHubActionsMeta(): Promise<GitMeta | undefined> {
152152 let commitMessage : string | undefined ;
153153 let pullRequestNumber : number | undefined ;
154154 let pullRequestTitle : string | undefined ;
155+ let pullRequestState : "open" | "closed" | "merged" | undefined ;
155156 let commitSha = process . env . GITHUB_SHA ;
156157
157158 if ( process . env . GITHUB_EVENT_PATH ) {
@@ -168,6 +169,12 @@ async function getGitHubActionsMeta(): Promise<GitMeta | undefined> {
168169 commitRef = eventData . pull_request ?. head ?. ref ;
169170 pullRequestNumber = eventData . pull_request ?. number ;
170171 commitSha = eventData . pull_request ?. head ?. sha ;
172+ pullRequestState = eventData . pull_request ?. state as "open" | "closed" ;
173+
174+ // Check if PR was merged
175+ if ( pullRequestState === "closed" && eventData . pull_request ?. merged === true ) {
176+ pullRequestState = "merged" ;
177+ }
171178
172179 await x ( "git" , [ "status" ] , {
173180 nodeOptions : {
@@ -201,6 +208,7 @@ async function getGitHubActionsMeta(): Promise<GitMeta | undefined> {
201208 ? parseInt ( process . env . GITHUB_PULL_REQUEST_NUMBER )
202209 : undefined ) ,
203210 pullRequestTitle,
211+ pullRequestState,
204212 } ;
205213}
206214
Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ export const GitMeta = z.object({
272272 remoteUrl : z . string ( ) . optional ( ) ,
273273 pullRequestNumber : z . number ( ) . optional ( ) ,
274274 pullRequestTitle : z . string ( ) . optional ( ) ,
275+ pullRequestState : z . enum ( [ "open" , "closed" , "merged" ] ) . optional ( ) ,
275276} ) ;
276277
277278export type GitMeta = z . infer < typeof GitMeta > ;
You can’t perform that action at this time.
0 commit comments