mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
f472c2615a
* ci/announce/highlight - add bot announcement section for "highlights" showing off important diffs + storybook highlights * ci/announce/highlight - fix announcement message * Update index.js * xxx tmp xxx * ci/announce/highlight - fix dirty file calculation * ci/announce/highlight - try/catch wrap highlight generation for build stability * ui - put fox emojis in the mascot component * ci/announce/highlight - start storybook permalinks * ci/announce/highlight - fix storybook permalink util * ci/announce/highlight - fix storybook permalink util * ci/announce/highlight - small styling fix * storybook - use any easily predictable story id * ci/announce/highlight - revert sample commit * ci/announce/highlight - minimal documentation
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
const { promisify } = require('util');
|
|
const exec = promisify(require('child_process').exec);
|
|
const storybook = require('./storybook.js');
|
|
|
|
module.exports = { getHighlights };
|
|
|
|
async function getHighlights({ artifactBase }) {
|
|
let highlights = '';
|
|
// here we assume the PR base branch ("target") is `develop` in lieu of doing
|
|
// a query against the github api which requires an access token
|
|
// see https://discuss.circleci.com/t/how-to-retrieve-a-pull-requests-base-branch-name-github/36911
|
|
const changedFiles = await getChangedFiles({ target: 'develop' });
|
|
console.log(`detected changed files vs develop:`);
|
|
for (const filename of changedFiles) {
|
|
console.log(` ${filename}`);
|
|
}
|
|
const announcement = await storybook.getHighlightAnnouncement({
|
|
changedFiles,
|
|
artifactBase,
|
|
});
|
|
if (announcement) {
|
|
highlights += announcement;
|
|
}
|
|
return highlights;
|
|
}
|
|
|
|
async function getChangedFiles({ target }) {
|
|
const { stdout } = await exec(`git diff --name-only ${target}...HEAD`);
|
|
const changedFiles = stdout.split('\n').slice(0, -1);
|
|
return changedFiles;
|
|
}
|