danger / peril

☢️ Serious and immediate danger.
https://danger.systems
MIT License
461 stars 58 forks source link

Use @octokit/app to cache Github tokens #443

Closed jtreanor closed 5 years ago

jtreanor commented 5 years ago

This is a first step towards fixing https://github.com/danger/peril/issues/440.

It updates the Github token fetching to use @octokit/app so that we do not fetch a new token for every single API request. Tokens are cached for 59 minutes.

It's good to reduce the calls we are making but also will reduce occurrences of https://github.com/danger/peril/issues/440 to at most once per hour. I will follow up with another PR to further address the issue.

Note: If you would prefer not to introduce a new dependency we could quite easily implement this caching within Peril.

orta commented 5 years ago

Nah, I prefer this - this is from GitHub who know GitHub stuff ™️

Thanks!