Skip to content

Commit

Permalink
feat: ci-info extension for circle ci
Browse files Browse the repository at this point in the history
  • Loading branch information
leelaprasadv committed Dec 15, 2024
1 parent 89dc1e2 commit 636d9f0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/helpers/ci/circle-ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const ENV = process.env;

/**
* @returns {import('../../extensions/extensions').ICIInfo}
*/
function info() {
const circle = {
ci: 'CIRCLE_CI',
git: '',
repository_url: ENV.CIRCLE_REPOSITORY_URL,
repository_name: ENV.CIRCLE_PROJECT_REPONAME, // Need to find a better match
repository_ref: ENV.CIRCLE_BRANCH,
repository_commit_sha: ENV.CIRCLE_SHA1,
branch_url: '',
branch_name: ENV.CIRCLE_BRANCH,
pull_request_url:'',
pull_request_name: '',
build_url: ENV.CIRCLE_BUILD_URL,
build_number: ENV.CIRCLE_BUILD_NUM,
build_name: ENV.CIRCLE_JOB,
build_reason: 'Push',
user: ENV.CIRCLE_USERNAME,
}
return circle
}

module.exports = {
info
}
4 changes: 4 additions & 0 deletions src/helpers/ci/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const github = require('./github');
const gitlab = require('./gitlab');
const jenkins = require('./jenkins');
const azure_devops = require('./azure-devops');
const circle_ci = require('./circle-ci');
const system = require('./system');

const ENV = process.env;
Expand Down Expand Up @@ -32,6 +33,9 @@ function getBaseCIInfo() {
if (ENV.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) {
return azure_devops.info();
}
if (ENV.CIRCLECI) {
return circle_ci.info();
}
return getDefaultInformation();
}

Expand Down

0 comments on commit 636d9f0

Please sign in to comment.