Skip to content
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 command for fetching the latest release info from a github repo #772

Merged
merged 5 commits into from Nov 3, 2018

Conversation

kaffein
Copy link
Member

@kaffein kaffein commented Oct 27, 2018

Hey guys,

Sorry that it took so long for me to come back for this PR but I wanted to get a little bit acquainted with the project (real beginner here ^^). In the end though, it feels good to learn some new stuff ;-) and fortunately, here is the first PR I can come up with.

This one is related to issue #729 : we wanted a command for fetching infos about the latest release on a github repository.
The syntax for the command is quite simple :

!gh releases org-name/repo

Here are some screenshots of how it renders :

  1. When simply asking the bot to fetch the latest release info
    gh_simple_call

  2. When asking for release infos which are, unfortunately, unavailable
    gh_releases_no_info_found

  3. When used with the already existing cron command
    gh_releases_result_on_cron

I hope my code is not too ugly ^^ but anyway, feel free to let me know of any changes that you want me to incorporate into the PR. I'd be glad to have your feedback especially on the Clojure idioms or anything else that can be improved.

thanks a lot for the opportunity o/

@codecov-io
Copy link

codecov-io commented Oct 27, 2018

Codecov Report

Merging #772 into master will decrease coverage by 0.34%.
The diff coverage is 21.62%.

@@            Coverage Diff             @@
##           master     #772      +/-   ##
==========================================
- Coverage   44.61%   44.27%   -0.35%     
==========================================
  Files          81       81              
  Lines        2434     2471      +37     
  Branches       84       84              
==========================================
+ Hits         1086     1094       +8     
- Misses       1264     1293      +29     
  Partials       84       84

@devth
Copy link
Member

devth commented Oct 27, 2018

Thanks for the PR! The code looks great.

If you want, we could expand the capabilities a bit to include:

  • list all known releases
  • show details for a specific release

So something like:

gh releases <org>/<repo-name> # list releases for a GitHub repo
gh releases show <org>/<repo-name> # show info for the latest release 
gh releases show <org>/<repo-name> <tag> # show info for a specific release

If you want to work on those feel free to continue on this PR, or if not I can merge this as is.

@kaffein
Copy link
Member Author

kaffein commented Oct 28, 2018

Thanks for your feedback,

I will work on these extensions from this same PR and will poke you again for reviews when it's ready ;-)

@kaffein
Copy link
Member Author

kaffein commented Oct 28, 2018

hey guys,

I have refactored the code according to @devth suggestions

so here are some screenshots of how it renders at the moment :

  1. When listing all releases from a Github repo
    gh_repo_releases

  2. When fetching info for the latest release from a Github repo
    gh_latest_release

  3. When fetching release info from a specific tag
    gh_existing_release_by_tag

  4. When fetching release info from a specific tag but the tag does not exist
    gh_no_matching_release_tag

There may be some ways to reduce boilerplate for these commands since displaying release infos are always almost the same. Only the wording and the information to be displayed change, depending on the command.

As usual, feel free to let me know if you guys think there are some other things that need to be improved or that I may have missed.

again thanks ...

@devth
Copy link
Member

devth commented Oct 29, 2018

@kaffein awesome! I'll review tomorrow.

@kaffein
Copy link
Member Author

kaffein commented Nov 1, 2018

Hey guys,

based on your reviews, I have done some refactoring to remove similar code.
I have also fixed a bug that I have introduced, related to how the published_at date was being parsed.

can you guys PTAL

thanks in advance

 - Refactor command for fetching latest release info from a Github repository
 - Add command for fetching release info by release version tag
 - Add command for listing all releases from a Github repository
 - Remove boilerplate code by introducing a utility function
 - Fix a bug related to how the release 'published_at' date is parsed
Copy link
Member

@devth devth left a comment

Choose a reason for hiding this comment

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

💯 thanks @kaffein !!

@devth devth merged commit f86a50c into yetibot:master Nov 3, 2018
@kaffein
Copy link
Member Author

kaffein commented Nov 3, 2018

thanks @devth :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants