From 1f49d0fe8c9ea92d13830fe7e24df2d825bb1a7d Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Fri, 31 Aug 2018 13:05:22 +0200
Subject: [PATCH] feat: add in-memory github datasource caching

---
 lib/datasource/github.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/datasource/github.js b/lib/datasource/github.js
index 3949cca124..59448cbf73 100644
--- a/lib/datasource/github.js
+++ b/lib/datasource/github.js
@@ -6,6 +6,8 @@ module.exports = {
   getPkgReleases,
 };
 
+const map = new Map();
+
 async function getPreset(pkgName, presetName = 'default') {
   if (presetName !== 'default') {
     throw new Error(
@@ -42,7 +44,10 @@ async function getPkgReleases(purl, config) {
     } else {
       // tag
       const url = `repos/${repo}/tags?per_page=100`;
-      versions = (await ghGot(url, { paginate: true })).body.map(o => o.name);
+      versions = (await ghGot(url, {
+        cache: process.env.RENOVATE_SKIP_CACHE ? undefined : map,
+        paginate: true,
+      })).body.map(o => o.name);
     }
   } catch (err) {
     logger.info(
-- 
GitLab