From 1f7b25e51c76b603fcb7191858d124f35c24a550 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 3 Sep 2018 16:19:02 +0200
Subject: [PATCH] fix: cache changelog on from/to

---
 lib/workers/pr/changelog/source-github.js                  | 6 +++---
 test/workers/pr/changelog/__snapshots__/index.spec.js.snap | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/workers/pr/changelog/source-github.js b/lib/workers/pr/changelog/source-github.js
index 7ff9f7404f..23fc1a8996 100644
--- a/lib/workers/pr/changelog/source-github.js
+++ b/lib/workers/pr/changelog/source-github.js
@@ -112,8 +112,8 @@ async function getChangeLogJSON({
   }
 
   const cacheNamespace = 'changelog-github-release';
-  function getCacheKey(version) {
-    return `${repository}:${version}`;
+  function getCacheKey(prev, next) {
+    return `${repository}:${prev}:${next}`;
   }
 
   const changelogReleases = [];
@@ -126,7 +126,7 @@ async function getChangeLogJSON({
     if (include(next.version)) {
       let release = await renovateCache.get(
         cacheNamespace,
-        getCacheKey(next.version)
+        getCacheKey(prev.version, next.version)
       );
       if (!release) {
         release = {
diff --git a/test/workers/pr/changelog/__snapshots__/index.spec.js.snap b/test/workers/pr/changelog/__snapshots__/index.spec.js.snap
index 67581a19c8..2709414b6a 100644
--- a/test/workers/pr/changelog/__snapshots__/index.spec.js.snap
+++ b/test/workers/pr/changelog/__snapshots__/index.spec.js.snap
@@ -163,6 +163,7 @@ Object {
     Object {
       "changes": Array [],
       "compare": Object {},
+      "date": undefined,
       "releaseNotes": undefined,
       "version": "2.5.2",
     },
@@ -189,6 +190,7 @@ Object {
       "compare": Object {
         "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
       },
+      "date": undefined,
       "releaseNotes": Object {
         "url": "https://github-enterprise.example.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
       },
-- 
GitLab