alexellis / derek

Reduce maintainer fatigue by automating GitHub
https://github.com/alexellis/derek/blob/master/USER_GUIDE.md
MIT License
806 stars 72 forks source link

Private repos support #119

Closed matipan closed 5 years ago

matipan commented 5 years ago

Signed-off-by: Matias Pan matias.pan26@gmail.com

This PR adds support for private repositories. To support this we had to change the way we were fetching the .DEREK.yml config file, if the repo is private we use GitHub's API, if it's not then we default to the CDN.

Description

In order to support fetching files from repositories that are private a new function was added called GetPrivateRepoConfig. This function uses GitHub's API to download the file instead of download it from the CDN. I thought it would be best to introduce a new function instead of rewriting the current one and changing its signature. This is because I wanted to make sure I wasn't breaking any existing functionality.

Motivation and Context

How Has This Been Tested?

I built derek at matipan/derek:privateRepos, deployed it on my personal cluster and tested it using a private repository: matipan/test-derek-private. (Request for access if you'd like to test it yourself :smile: ) Derek in action: derek-private-repos Event for pull requests: derek-private-repos-event-pr

Event for issue comments: derek-private-repos-event-issue

Types of changes

Checklist:

alexellis commented 5 years ago

cc @boyney123

matipan commented 5 years ago

This repo can be used to test that this changes are not breaking the existing functionality with public repositories: https://github.com/matipan/test-derek

alexellis commented 5 years ago

Possibly but I'm a fan of iteration. This is almost complete but I think we should use the SDK to grab the file.

matipan commented 5 years ago

@alexellis the code was already updated to use the SDK instead :+1: Good point @rgee0, @alexellis do you want to leave that change for the future or should I add it to this PR?