Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Make context.issue and context.repo objects#61

Merged
JasonEtco merged 1 commit intoJasonEtco:v2from
jclem:issue-repo-objects
Mar 20, 2019
Merged

Make context.issue and context.repo objects#61
JasonEtco merged 1 commit intoJasonEtco:v2from
jclem:issue-repo-objects

Conversation

@jclem
Copy link
Contributor

@jclem jclem commented Mar 20, 2019

The way that context.issue and context.repo are functions that merge their arguments has been a point of confusion for me quite a bit.

Given that Node supports object spread, and you can achieve the same goal with that, does it make sense for context.issue and context.repo to just be (frozen) objects, instead? Before I read over the readme in much more detail, it's how I expected it to work, and looks a little more idiomatic to me.

const payload = context.issue({body: 'Hello, world!'})

vs

const payload = {...context.issue, body: 'Hello, world!'}

@JasonEtco
Copy link
Owner

JasonEtco commented Mar 20, 2019

I'm so glad that someone finally said something 😅 this is a remnant of Probot's code (I quite literally copy-pasted), and that decision was made in Probot before the object spread operator was in LTS Node. That's not a good enough reason for it to be here though!

Unfortunately, this is the kind of change that will break almost every action, so it'll need mean a breaking change/new major version to v2 (which should already be done for #41). In any case, still very much in favor.

@jclem
Copy link
Contributor Author

jclem commented Mar 20, 2019

Sounds good! This was a quick change, so no worries if you close this PR and implement it later!

@JasonEtco
Copy link
Owner

I think this is a good enough reason to introduce a new major version, especially because of #41 - I'll get a v2 branch going and update this PR's base 🎉 Thanks @jclem ❤️

@JasonEtco JasonEtco mentioned this pull request Mar 20, 2019
2 tasks
@JasonEtco JasonEtco changed the base branch from master to v2 March 20, 2019 22:47
@JasonEtco JasonEtco mentioned this pull request Mar 20, 2019
2 tasks
@JasonEtco JasonEtco merged commit 77c19fb into JasonEtco:v2 Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants