File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Update Code.json
22on :
33 workflow_dispatch :
4- push :
5- branches :
6- - " code-json-*"
4+ pull_request :
5+ types : [opened, synchronize]
76 paths :
87 - " code.json"
98
Original file line number Diff line number Diff line change @@ -121,11 +121,9 @@ async function getMetaData(
121121export async function run ( ) : Promise < void > {
122122 try {
123123 const eventName = process . env . GITHUB_EVENT_NAME ;
124- const refName = process . env . GITHUB_REF ;
125- core . info ( `Event name: ${ eventName } ` ) ;
126124
127- if ( eventName === "push" && refName ?. startsWith ( "refs/heads/code-json-" ) ) {
128- core . info ( "Detected push to PR branch - validating only!" ) ;
125+ if ( eventName === "pull_request" ) {
126+ core . info ( "Detected pull_request event - validating only!" ) ;
129127 await helpers . validateOnly ( ) ;
130128 return ;
131129 }
@@ -153,7 +151,7 @@ export async function run(): Promise<void> {
153151 const validationErrors = helpers . validateCodeJSON ( finalCodeJSON ) ;
154152
155153 if ( validationErrors . length > 0 ) {
156- const errorMessage = `Generated code.json is invalid:\n\n ${ validationErrors . map ( ( err , idx ) => `${ idx + 1 } . ${ err } ` ) . join ( "\n" ) } ` ;
154+ const errorMessage = `Generated code.json is invalid:\n${ validationErrors . map ( ( err , idx ) => `${ idx + 1 } . ${ err } ` ) . join ( "\n" ) } ` ;
157155 core . setFailed ( errorMessage ) ;
158156 return ;
159157 }
You can’t perform that action at this time.
0 commit comments