question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

context.config doesn’t work with config root is an array

See original GitHub issue

Bug Report

A *.yml file can return an Array, just like JSON. The problem is that we implement the defaulting of configuration using Object.assign() which doesn’t work with arrays too well, it turns an array into an object

https://github.com/probot/probot/blob/dee76d207b0fc35be9ae394d9e0602351d7c9701/src/context.ts#L127-L145

Besides Object.assign does only default on the top level, not deeply. I’d recommend to use _.defaultsDeep instead.

In my particular case I want to implement configuration as described at https://github.com/wip/app/issues/96#issuecomment-397750538

When .github/wip.yml looks like this:

- terms:
   - hold
 locations:
   - label
- terms:
   - fixup!
   - squash!
 locations:
   - commits

and I load the config like this

const config = await context.config('wip.yml')

Current Behavior

config is an object with two keys: {1: {...}, 2: {...}}

Expected behavior/code

config should be an array with two items: [{terms, locations}, {terms, locations}]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BPScottcommented, Aug 29, 2018

Would be solved by #619

0reactions
stale[bot]commented, Oct 28, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appending within an array could work if we could reference ...
I am facing a situation that I don't understand. In my config file if I write at the top level: exports += {...
Read more >
Add context path to Spring Boot application - Stack Overflow
The reason for the context root is we want the app to be accessed from localhost:port/{app_name} and have all the controller paths append...
Read more >
Configuring Jest
The Jest philosophy is to work great by default, but sometimes you just ... To read TypeScript configuration files Jest requires ts-node ....
Read more >
Content Configuration - Tailwind CSS
Configuring the content sources for your project. The content section of your tailwind.config.js file is where you configure the paths to all of...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found