Skip to content

Commit

Permalink
Support CircleCI 2.0 (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth authored Feb 18, 2017
1 parent 2408ca9 commit 3c36cfa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/services/circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,23 @@ module.exports = {
commit : process.env.CIRCLE_SHA1,
branch : process.env.CIRCLE_BRANCH,
pr: process.env.CIRCLE_PR_NUMBER,
slug : process.env.CIRCLE_PROJECT_USERNAME + '/' + process.env.CIRCLE_PROJECT_REPONAME,
slug : detectRepoSlug(),
};
function detectRepoSlug(){
if (process.env.CIRCLE_PROJECT_REPONAME) {
// CircleCI 1.0
// CIRCLE_PROJECT_REPONAME=codecov
// CIRCLE_PROJECT_USERNAME=codecov-node
// CIRCLE_REPOSITORY_URL=https://github.com/codecov/codecov-node (note: GitHub Web URL)
return process.env.CIRCLE_PROJECT_USERNAME + '/' + process.env.CIRCLE_PROJECT_REPONAME;
}
if (process.env.CIRCLE_REPOSITORY_URL) {
// CircleCI 2.0
// CIRCLE_REPOSITORY_URL=git@github.com:codecov/codecov-node.git (note: Git/SSH URL)
return process.env.CIRCLE_REPOSITORY_URL.replace(/^.*:/, '').replace(/\.git$/, '');
}
throw new Error('Cannot detect repository slug.');
}
}

};

0 comments on commit 3c36cfa

Please sign in to comment.