Skip to content

Commit

Permalink
chore: removed empty string and added throws
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed May 20, 2024
1 parent 8fe5405 commit eb6c3a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/github/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async function handleEvent(event: EmitterWebhookEvent, eventHandler: InstanceTyp
inputs: new Array(pluginChain.uses.length),
};

const ref = isGithubPluginObject ? plugin.ref ?? (await getDefaultBranch(context, plugin.owner, plugin.repo)) : "";
const ref = isGithubPluginObject ? plugin.ref ?? (await getDefaultBranch(context, plugin.owner, plugin.repo)) : plugin;
const token = await eventHandler.getToken(event.payload.installation.id);
const inputs = new DelegatedComputeInputs(stateId, context.key, event.payload, settings, token, ref);

Expand Down
6 changes: 2 additions & 4 deletions src/github/handlers/repository-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export async function repositoryDispatch(context: GitHubContext<"repository_disp

const currentPlugin = state.pluginChain[state.currentPlugin];
if (!isGithubPlugin(currentPlugin.plugin)) {
console.error("Trying to call a non-github plugin.");
return;
throw new Error("Trying to call a non-github plugin.");
}
if (currentPlugin.plugin.owner !== context.payload.repository.owner.login || currentPlugin.plugin.repo !== context.payload.repository.name) {
console.error("Plugin chain state does not match payload");
Expand All @@ -52,8 +51,7 @@ export async function repositoryDispatch(context: GitHubContext<"repository_disp
return;
}
if (!isGithubPlugin(nextPlugin.plugin)) {
console.error("Trying to call a non-github plugin.");
return;
throw new Error("Trying to call a non-github plugin.");
}
console.log("Dispatching next plugin", nextPlugin);

Expand Down

0 comments on commit eb6c3a3

Please sign in to comment.