bluzi / travis-buddy

:rocket: Seamless integration between TravisCI and GitHub
https://www.travisbuddy.com/
MIT License
252 stars 20 forks source link

TravisBuddy Reactions - Labels #53

Open bluzi opened 6 years ago

bluzi commented 6 years ago

Summary

The idea of TravisBuddy Reactions is to allow contributors to communicate with TravisBuddy using comments and labels.

travisbuddy-ignore label

Adding a label named travisbuddy-ignore to a PR should force TravisBuddy to ignore this PR and stop commenting on it. Just like in #37, routes/api.routes.js is probably the right place to query GitHub and see if the label is presented in the PR, and drop the request.

panmona commented 6 years ago

This sounds interesting: I'd like to help with this. Just had a short look into this.

What wrapper do you use for the GitHub API / Where can I find the docs? Because as far as I saw a getLabels functionality isn't implemented in utils.js yet.

Do you have any automated tests which should be expanded to test this new functionality?

bluzi commented 6 years ago

Sorry, missed this comment somehow.

I'm using a fork of github-tools/github, that can be found here: bluzi/github. I needed some more functionality at some point and had to fork it to add few things.

Querying the labels really is the challenge of this task, you can read about it at https://developer.github.com/v3/.

As to the tests, you can add make a simple unit test.

Note that if you're working on it you probably want to rebase your fork since I've made a big change to the codebase.

panmona commented 6 years ago

Okay thanks @bluzi. I began looking into this. I think we need to use this method here but I can't find it in the docs of the github-tools. So I think we need a new method there?

bluzi commented 6 years ago

Yup, github-tools suck. That's why I created this fork when I needed a method that was also missing there.

IMHO the best thing would be if you'd make a PR that adds listLabels to my fork, and then we'll publish it and use it in TravisBuddy.

What do you think?

panmona commented 6 years ago

@bluzi Sounds good. I'll look into that now. Maybe that could also be made to a PR in the upstream project? (that doesn't seem to be active anymore :/)

panmona commented 6 years ago

I think I need pagination for this aswell like the change you made to the comment list methods, right?

bluzi commented 6 years ago

Probably. If I remember correctly every method in GitHub API brings up to 30 entities per page, so 30 labels on one issue is pretty rear, but just in case i guess

bluzi commented 6 years ago

And yeah, I guess it worth a PR in the upstream repo, though it's true it's no longer maintained.

I'm thinking about taking this fork as a project to make a decent GitHub API for Node, since it's not the first time github-tool disappoints me, and it doesn't seem like there's an alternative.

panmona commented 6 years ago

@bluzi Okay, just in case then.

And for the GitHub API: I have also looked around for alternatives. I have found two repos:

Haven't looked into the second one yet. But your idea also sounds good, check the second one out first though.

bluzi commented 6 years ago

gh3 doesn't even support promises. As far as I could find, there are no good products in the market of github api wrappers for Node :(

panmona commented 6 years ago

Okay that's sad to hear. For now I think the best way to move forward is to extend the github tools repo.

Have you released the new version to npm?

panmona commented 6 years ago

Look what I just found @bluzi: https://github.com/octokit/rest.js It looks really good! :)

bluzi commented 6 years ago

That's awesome, I'd even like to convert all the code related to github-api to use this library.

tustin2121 commented 6 years ago

I'd like to add this ability should be stated somewhere on the comment it posts. Because I don't care about Travis results: I don't use it, but the fork of the very active project I forked from does, and I'd really prefer if it didn't comment every time they push yet another commit to their master I've got a PR from... And I've gotten very annoyed with this bot filling my inbox with pointless comments... Even a link somewhere saying "am I doing bad? Click here to see how to turn me off" would be wonderful...

panmona commented 6 years ago

@tustin2121 This isn't implemented yet. Easiest way currently is to remove it from .travis.yml

bluzi commented 6 years ago

@tustin2121

a. Your comment is not related to the above issue at all, no idea why you chose to post it here b. Finding out how to disable TravisBuddy is as easy as pressing its name to enter its profile page, pressing on the repository link and reading the README.

tustin2121 commented 6 years ago

@bluzi a) This issue mentioned the problem I was having with it posting in a Pull Request, which it was doing several times in a single day. b) That's too many clicks, in my opinion. But never mind anyway, because I recently found what caused the bot to suddenly become interested in my PR (added by the upstream project and not me), and I'll be putting a bullet in that bit. So, I apologize for the rage-induced comment.