Skip to content

Commit

Permalink
chore: typebox debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Sep 4, 2024
1 parent db9dcb0 commit 8986d67
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/workflow-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ import { bubbleUpErrorComment, sanitizeMetadata } from "./utils/errors";
*/
export async function run() {
const payload = github.context.payload.inputs;
let env, settings;
try {
env = Value.Decode(envValidator.schema, payload.env);
} catch (err) {
console.log("Error decoding env: ", err);
}

try {
settings = Value.Decode(pluginSettingsSchema, Value.Default(pluginSettingsSchema, JSON.parse(payload.settings)));
} catch (err) {
console.log("Error decoding settings: ", err);
}

const env = Value.Decode(envValidator.schema, payload.env);
const settings = Value.Decode(pluginSettingsSchema, Value.Default(pluginSettingsSchema, JSON.parse(payload.settings)));
if (!(settings && env)) {
throw new Error("Invalid settings or env provided");
}

if (!pluginSettingsValidator.test(settings)) {
throw new Error("Invalid settings provided");
Expand Down

0 comments on commit 8986d67

Please sign in to comment.