Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds support for posting statuses #280

Merged
merged 2 commits into from
Jun 13, 2017
Merged

Adds support for posting statuses #280

merged 2 commits into from
Jun 13, 2017

Conversation

orta
Copy link
Member

@orta orta commented Jun 12, 2017

Re: #279

This has no tests, but shouldn't be too hard to add them pretty soon.

@orta orta force-pushed the status branch 4 times, most recently from 6010047 to f2e38b0 Compare June 12, 2017 16:46
Copy link
Member

@macklinu macklinu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few initial comments. Really good idea - I've seen these on PRs in GitHub but didn't know this was the API for creating those statuses. 👍


const messageForResults = (results: DangerResults) => {
if (results.fails.length && results.warnings.length) {
return `All green. ${compliment()}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice touch. 😄


let message = "⚠️ "
if (results.fails.length) {
message += pluralize("Errors", results.fails)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible bug (if I'm reading this function correctly): when there are 0 errors, pluralize() will return "0 Errors"; when there is more than 1 error, pluralize() will return "n Errorss" with two s's.

Looking at some example success and failure statuses I see on GitHub:

image

image

Thoughts on stating "⚠️ Danger found some issues. Don't worry, everything is fixable." for any warnings or errors? I feel like that wording is generic enough for all cases and simplifies this function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems fine 👍

@@ -43,20 +43,10 @@ export interface Platform {
editMainComment: (newComment: string) => Promise<any>
/** Replace the main Danger comment */
updateOrCreateComment: (newComment: string) => Promise<any>
/** Fails the current PR */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on changing this doc comment to something like "Sets the current PR's status. See the GitHub Statuses API documentation." to document that this could either set the PR status as success or failure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aye

@orta
Copy link
Member Author

orta commented Jun 12, 2017

So the Danger token on danger doesn't support the status API, but I trust that it's OK

@orta
Copy link
Member Author

orta commented Jun 12, 2017

ill try write some tests tomorrrow

@orta
Copy link
Member Author

orta commented Jun 12, 2017

Tomorrow comes today - @macklinu if you're up to it, you're welcome to merge + ship this as a release, I'll update the Artsy danger instance to verify it all etc in the UK morning

@macklinu
Copy link
Member

Yeah I can release a minor update this afternoon/evening - will test at my work as well. I'm still not super clear on how you ship updates, like this commit - d8d1326. Tried reading through #117 but I'm still not 100% on it:

  • modify the changelog and package.json with the new version
  • commit
  • run npm publish? (I feel like a git tag or npm version is missing from this list)

Thanks @orta 😄

@orta
Copy link
Member Author

orta commented Jun 12, 2017

No worries, yeah, I make those commits then push a tag - that's it

@orta
Copy link
Member Author

orta commented Jun 12, 2017

The tag triggers a deploy on travis, I'm still new to this idea of not deploying locally - in ruby I make these PRs, danger/danger#836 then do rake deploy which is yarn publish and then it runs https://github.com/mattbrictson/chandler

@orta
Copy link
Member Author

orta commented Jun 12, 2017

I wanna try this semanticc versioning biz, but not got futher

@macklinu
Copy link
Member

That's funny; I actually like deploying from CI more than I do locally. 😄 But I'm going to merge this and ship 0.21.0 using the current deployment process. Thanks for clarifying!

@macklinu macklinu merged commit ecacadb into master Jun 13, 2017
@macklinu macklinu deleted the status branch June 13, 2017 00:39
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants