{"action":"created","issue":{"url":"https://api.github.com/repos/probot/probot/issues/592","repository_url":"https://api.github.com/repos/probot/probot","labels_url":"https://api.github.com/repos/probot/probot/issues/592/labels{/name}","comments_url":"https://api.github.com/repos/probot/probot/issues/592/comments","events_url":"https://api.github.com/repos/probot/probot/issues/592/events","html_url":"https://github.com/probot/probot/issues/592","id":336432947,"node_id":"MDU6SXNzdWUzMzY0MzI5NDc=","number":592,"title":"context.config doesn’t work with config root is an array","user":{"login":"gr2m","id":39992,"node_id":"MDQ6VXNlcjM5OTky","avatar_url":"https://avatars3.githubusercontent.com/u/39992?v=4","gravatar_id":"","url":"https://api.github.com/users/gr2m","html_url":"https://github.com/gr2m","followers_url":"https://api.github.com/users/gr2m/followers","following_url":"https://api.github.com/users/gr2m/following{/other_user}","gists_url":"https://api.github.com/users/gr2m/gists{/gist_id}","starred_url":"https://api.github.com/users/gr2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gr2m/subscriptions","organizations_url":"https://api.github.com/users/gr2m/orgs","repos_url":"https://api.github.com/users/gr2m/repos","events_url":"https://api.github.com/users/gr2m/events{/privacy}","received_events_url":"https://api.github.com/users/gr2m/received_events","type":"User","site_admin":false},"labels":[{"id":443971426,"node_id":"MDU6TGFiZWw0NDM5NzE0MjY=","url":"https://api.github.com/repos/probot/probot/labels/bug%20%F0%9F%90%9E","name":"bug 🐞","color":"ee0701","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-28T00:29:38Z","updated_at":"2018-06-29T23:55:03Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Bug Report\r\n\r\nA `*.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\r\n\r\nhttps://github.com/probot/probot/blob/dee76d207b0fc35be9ae394d9e0602351d7c9701/src/context.ts#L127-L145\r\n\r\nBesides Object.assign does only default on the top level, not deeply. I’d recommend to use [`_.defaultsDeep`](https://lodash.com/docs/4.17.10#defaultsDeep) instead.\r\n\r\nIn my particular case I want to implement configuration as described at https://github.com/wip/app/issues/96#issuecomment-397750538\r\n\r\nWhen `.github/wip.yml` looks like this:\r\n\r\n```yml\r\n- terms:\r\n   - hold\r\n locations:\r\n   - label\r\n- terms:\r\n   - fixup!\r\n   - squash!\r\n locations:\r\n   - commits\r\n```\r\n\r\nand I load the config like this\r\n\r\n```js\r\nconst config = await context.config('wip.yml')\r\n```\r\n\r\n**Current Behavior**\r\n\r\n`config` is an object with two keys: `{1: {...}, 2: {...}}`\r\n\r\n**Expected behavior/code**\r\n\r\n`config` should be an array with two items: `[{terms, locations}, {terms, locations}]`"},"comment":{"url":"https://api.github.com/repos/probot/probot/issues/comments/401500822","html_url":"https://github.com/probot/probot/issues/592#issuecomment-401500822","issue_url":"https://api.github.com/repos/probot/probot/issues/592","id":401500822,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTUwMDgyMg==","user":{"login":"gr2m","id":39992,"node_id":"MDQ6VXNlcjM5OTky","avatar_url":"https://avatars3.githubusercontent.com/u/39992?v=4","gravatar_id":"","url":"https://api.github.com/users/gr2m","html_url":"https://github.com/gr2m","followers_url":"https://api.github.com/users/gr2m/followers","following_url":"https://api.github.com/users/gr2m/following{/other_user}","gists_url":"https://api.github.com/users/gr2m/gists{/gist_id}","starred_url":"https://api.github.com/users/gr2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gr2m/subscriptions","organizations_url":"https://api.github.com/users/gr2m/orgs","repos_url":"https://api.github.com/users/gr2m/repos","events_url":"https://api.github.com/users/gr2m/events{/privacy}","received_events_url":"https://api.github.com/users/gr2m/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T23:55:03Z","updated_at":"2018-06-29T23:55:03Z","author_association":"CONTRIBUTOR","body":"yes, it’s the `Object.assign()`"}}
{"actor":{"display_login":"gr2m"}}