Skip to content

Commit

Permalink
fix: correctly set default values for arrays
Browse files Browse the repository at this point in the history
now `[]` will override the default value.
  • Loading branch information
jamacku committed Sep 26, 2024
1 parent 552dc0d commit b9439b6
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
38 changes: 38 additions & 0 deletions dist/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/config.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ export class Config {
static async getConfig(octokit: CustomOctokit): Promise<Config> {
const path = getInput('config-path', { required: true });

const overwriteMerge = (
_defaultArray: string[],
configArray: string[],
_options?: deepmerge.Options
) => configArray;

const retrievedConfig = (
await octokit.config.get({
...context.repo,
path,
defaults: configs =>
deepmerge.all([this.defaults, ...configs]) as Partial<Config>,
deepmerge.all([this.defaults, ...configs], {
arrayMerge: overwriteMerge,
}) as Partial<Config>,
})
).config;

Expand Down

0 comments on commit b9439b6

Please sign in to comment.