Skip to content
Snippets Groups Projects
Commit 16704950 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: don’t look up release notes compare URLs by date

parent 5e381501
No related branches found
No related tags found
No related merge requests found
...@@ -39,23 +39,6 @@ async function getTags(endpoint, versionScheme, repository) { ...@@ -39,23 +39,6 @@ async function getTags(endpoint, versionScheme, repository) {
} }
} }
async function getDateRef(endpoint, repository, timestamp) {
if (!timestamp) {
return null;
}
logger.trace({ repository, timestamp }, 'Looking for commit SHA by date');
try {
const res = await ghGot(`repos/${repository}/commits/@{${timestamp}}`, {
endpoint,
});
const commit = res && res.body;
return commit && commit.sha;
} catch (err) {
logger.debug({ err, repository }, 'Failed to fetch Github commit by date');
return null;
}
}
async function getChangeLogJSON({ async function getChangeLogJSON({
versionScheme, versionScheme,
fromVersion, fromVersion,
...@@ -112,7 +95,7 @@ async function getChangeLogJSON({ ...@@ -112,7 +95,7 @@ async function getChangeLogJSON({
if (release.gitRef) { if (release.gitRef) {
return release.gitRef; return release.gitRef;
} }
return getDateRef(config.endpoint, repository, release.releaseTimestamp); return null;
} }
const cacheNamespace = 'changelog-github-release'; const cacheNamespace = 'changelog-github-release';
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`workers/pr/changelog getChangeLogJSON falls back to commit from release time 1`] = `
Object {
"hasReleaseNotes": true,
"project": Object {
"github": "chalk/chalk",
"githubBaseURL": "https://github.com/",
"repository": "https://github.com/chalk/chalk",
},
"versions": Array [
Object {
"changes": Array [],
"compare": Object {},
"date": undefined,
"releaseNotes": undefined,
"version": "2.5.2",
},
Object {
"changes": Array [],
"compare": Object {
"url": "https://github.com/chalk/chalk/compare/npm_2.3.0...sha_from_time",
},
"date": "2017-12-24T03:20:46.238Z",
"releaseNotes": Object {
"url": "https://github.com/chalk/chalk/compare/npm_2.3.0...sha_from_time",
},
"version": "2.4.2",
},
Object {
"changes": Array [],
"compare": Object {
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"date": "2017-10-24T03:20:46.238Z",
"releaseNotes": Object {
"url": "https://github.com/chalk/chalk/compare/npm_2.2.2...npm_2.3.0",
},
"version": "2.3.0",
},
Object {
"changes": Array [],
"compare": Object {
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"date": undefined,
"releaseNotes": Object {
"url": "https://github.com/chalk/chalk/compare/npm_1.0.0...npm_2.2.2",
},
"version": "2.2.2",
},
],
}
`;
exports[`workers/pr/changelog getChangeLogJSON filters unnecessary warns 1`] = ` exports[`workers/pr/changelog getChangeLogJSON filters unnecessary warns 1`] = `
Object { Object {
"hasReleaseNotes": true, "hasReleaseNotes": true,
......
...@@ -103,22 +103,6 @@ describe('workers/pr/changelog', () => { ...@@ -103,22 +103,6 @@ describe('workers/pr/changelog', () => {
}) })
).toMatchSnapshot(); ).toMatchSnapshot();
}); });
it('falls back to commit from release time', async () => {
// mock tags response
ghGot.mockReturnValueOnce(Promise.resolve());
// mock commit time response
ghGot.mockReturnValue(
Promise.resolve({
body: { sha: 'sha_from_time' },
})
);
expect(
await getChangeLogJSON({
...upgrade,
depName: '@renovate/no',
})
).toMatchSnapshot();
});
it('returns cached JSON', async () => { it('returns cached JSON', async () => {
const first = await getChangeLogJSON({ ...upgrade }); const first = await getChangeLogJSON({ ...upgrade });
const firstCalls = [...ghGot.mock.calls]; const firstCalls = [...ghGot.mock.calls];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment