Skip to content

Commit

Permalink
[Danger] Add a remote for the upstream repo, and try use that for the…
Browse files Browse the repository at this point in the history
… merge base for danger
  • Loading branch information
orta committed Feb 15, 2018
1 parent 86ee9e8 commit f33f98f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ function setBoldness(row, isBold) {
}
}

/**
* Gets the commit that represents the merge between the current branch
* and master.
*/
function getMergeBase() {
return git('merge-base HEAD origin/master');
}

/**
* Gets the commit that represents the merge between the current branch
* and master.
Expand All @@ -100,7 +92,12 @@ function git(args) {
(async function() {
// Use git locally to grab the commit which represents the place
// where the branches differ
const mergeBaseCommit = await getMergeBase();
const upstreamRepo = danger.github.pr.base.repo.full_name;
const upstreamRef = danger.github.pr.base.ref;
await git(`remote add upstream https://github.com/${upstreamRepo}.git`);
await git('fetch upstream');
const mergeBaseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);

const commitURL = sha =>
`http://react.zpao.com/builds/master/_commits/${sha}/results.json`;
const response = await fetch(commitURL(mergeBaseCommit));
Expand Down

0 comments on commit f33f98f

Please sign in to comment.