Skip to content

Commit

Permalink
Merge pull request #235 from gentlementlegen/fix/skip-bot-events-decode
Browse files Browse the repository at this point in the history
fix: the default values for skipBotEvents and ubiquity:listeners is no longer overridden
  • Loading branch information
gentlementlegen authored Jan 22, 2025
2 parents cacf27f + ec99ca7 commit 2d59a51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/github/types/plugin-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const pluginChainSchema = T.Array(
plugin: githubPluginType(),
with: T.Record(T.String(), T.Unknown(), { default: {} }),
runsOn: T.Array(emitterType, { default: [] }),
skipBotEvents: T.Boolean({ default: true }),
skipBotEvents: T.Optional(T.Boolean({ default: true })),
}),
{ minItems: 1, default: [] }
);
Expand Down
8 changes: 6 additions & 2 deletions src/github/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ export async function getConfig(context: GitHubContext): Promise<PluginConfigura
for (const plugin of mergedConfiguration.plugins) {
const manifest = await getManifest(context, plugin.uses[0].plugin);
if (manifest) {
plugin.uses[0].runsOn = manifest["ubiquity:listeners"] ?? [];
plugin.uses[0].skipBotEvents = manifest.skipBotEvents ?? true;
if (!plugin.uses[0].runsOn.length) {
plugin.uses[0].runsOn = manifest["ubiquity:listeners"] ?? [];
}
if (plugin.uses[0].skipBotEvents === undefined) {
plugin.uses[0].skipBotEvents = manifest.skipBotEvents ?? true;
}
}
}
return mergedConfiguration;
Expand Down
4 changes: 3 additions & 1 deletion tests/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe("Configuration tests", () => {
plugins:
- uses:
- plugin: ubiquity/user-activity-watcher:compute.yml@fork/pull/1
skipBotEvents: false
with:
settings1: 'enabled'`;
} else {
Expand Down Expand Up @@ -187,14 +188,15 @@ describe("Configuration tests", () => {
"ubiquity:example": "/command"
}
},
"skipBotEvents": false
"skipBotEvents": true
}
`;
} else if (args.path === CONFIG_FULL_PATH) {
data = `
plugins:
- uses:
- plugin: ubiquity/test-plugin
skipBotEvents: false
with:
settings1: 'enabled'`;
} else {
Expand Down

0 comments on commit 2d59a51

Please sign in to comment.