Skip to content

Commit

Permalink
refactor: remove Hotfix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
loddit committed Aug 17, 2017
1 parent 169823b commit 31a41a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const config = JSON.parse(fs.readFileSync('.config.json','utf8'));
const token = config.token;
const repoPath = config.repo_path;
const baseBranch = process.argv[2] || config.repo_branch || 'master';
const isHotfix = !!process.argv[2];

legilimens(token, repoPath, baseBranch, (output) => {
console.log(output);
Expand Down
6 changes: 3 additions & 3 deletions legilimens.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function callGithubAPI({url, token=null, callback}) {
}, callback);
}

function getLastedReleaseTime(token, repoPath) {
function getLastedReleaseTime(token, repoPath, baseBranch="master") {
const repoUrl = `${GITHUB_REPO_API_ROOT}${repoPath}`;
return new Promise((resolve, reject) => {
callGithubAPI({
Expand All @@ -27,7 +27,7 @@ function getLastedReleaseTime(token, repoPath) {
switch (response.statusCode) {
case 200:
const lastedRelease = JSON.parse(body).filter(release => {
return ((release.target_commitish === 'master') || isHotfix) && !release.prerelease;
return release.target_commitish === baseBranch && !release.prerelease;
})[0];
const lastedReleaseTime = lastedRelease ? new Date(lastedRelease.created_at) : new Date(1970,1,1);
return resolve(lastedReleaseTime);
Expand Down Expand Up @@ -77,7 +77,7 @@ function renderPullRequestsReport(pullRequests) {


module.exports = (token, repoPath, baseBranch, callback) => {
getLastedReleaseTime(token, repoPath).then((lastedReleaseTime) => {
getLastedReleaseTime(token, repoPath, baseBranch).then((lastedReleaseTime) => {
getClosedPullRequestsAfter(token, repoPath, lastedReleaseTime, baseBranch, callback);
});
}

0 comments on commit 31a41a6

Please sign in to comment.