-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for probot-config #90
Add support for probot-config #90
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks @pholleran. I left two small comments but other than that this looks good to go.
index.js
Outdated
const payload = context.payload | ||
const defaultBranch = payload.ref === 'refs/heads/' + payload.repository.default_branch | ||
|
||
const config = getConfig(context, 'settings.yml') | ||
console.log(config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to context.log()
? Might as well get the free extra data 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JasonEtco - or we can delete it. That's a remnant of some of my debugging.
index.js
Outdated
const payload = context.payload | ||
const defaultBranch = payload.ref === 'refs/heads/' + payload.repository.default_branch | ||
|
||
const config = getConfig(context, 'settings.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be await
ed otherwise it might return a pending Promise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🆒 thanks @pholleran!
Oh hm looks like CI is failing now. Let me know if you want help digging into it @pholleran. |
@JasonEtco - thanks for offering up some help, I'd appreciate it. I'm pretty new to Jest and am having trouble identifying the underlying problem |
Hey @pholleran @jwsloan - sorry about the delay, not sure how four days went by but alas here we are. Of the two (this PR and #93), I think I prefer this approach. It requires less mocking, and these test look clearer to me. I also tend to avoid calling As for the failing tests, You can see the changes in a61b3c7 - I've created a mocked GitHub API client and made If y'all agree I'll go ahead and merge this. Let me know what you think. |
@JasonEtco - thanks for the help with the tests. I'm 🆒 with merging this one - just happy to get the functionality added |
Thanks for the explanation, @JasonEtco! And for the link. I'm a Ruby person trying to write reasonable JS, so all info is much appreciated. I'm just glad to see this functionality make it in. My company is almost certain to start using this app now. |
This PR fixes #89 and implements support for probot/config
I have also reformatted
robot.on
withinindex.js
to use an arrow function, as per most other probot apps. I've started playing around with changing themodule.exports
statement to be more in line with other probot apps by doing something like:but that started causing test failures I have not yet diagnosed. If that's something that makes sense to add to this PR I'm happy to dig in a bit more.