Skip to content

Commit 8f25c15

Browse files
changed back to on PR to include checks
1 parent e0686bd commit 8f25c15

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

.github/workflows/updateCodeJSON.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Update Code.json
22
on:
33
workflow_dispatch:
4-
push:
5-
branches:
6-
- "code-json-*"
4+
pull_request:
5+
types: [opened, synchronize]
76
paths:
87
- "code.json"
98

src/main.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ async function getMetaData(
121121
export 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
}

0 commit comments

Comments
 (0)