Skip to content

Commit

Permalink
feat(ci): support Bitrise CI (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfez authored Nov 24, 2023
1 parent 0cdfcea commit 98c8359
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/core/src/ci-environment/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import bitrise from "./services/bitrise";
import buildkite from "./services/buildkite";
import heroku from "./services/heroku";
import githubActions from "./services/github-actions";
Expand All @@ -10,13 +11,16 @@ import { debug } from "../debug";

export { CiEnvironment };

// List of services ordered by usage
// "git" must be the last one
const services = [
heroku,
githubActions,
circleci,
travis,
buildkite,
gitlab,
bitrise,
git,
];

Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/ci-environment/services/bitrise.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Service, Context } from "../types";

const getPrNumber = ({ env }: Context) => {
return env.BITRISE_PULL_REQUEST ? Number(env.BITRISE_PULL_REQUEST) : null;
};

const service: Service = {
name: "Bitrise",
detect: ({ env }) => Boolean(env.BITRISE_IO),
config: ({ env }) => {
return {
commit: env.BITRISE_GIT_COMMIT || null,
branch: env.BITRISE_GIT_BRANCH || null,
owner: env.BITRISEIO_GIT_REPOSITORY_OWNER || null,
repository: env.BITRISEIO_GIT_REPOSITORY_SLUG || null,
jobId: null,
runId: null,
prNumber: getPrNumber({ env }),
prHeadCommit: null,
nonce: env.BITRISEIO_PIPELINE_ID || null,
};
},
};

export default service;
1 change: 0 additions & 1 deletion packages/core/src/ci-environment/services/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const service: Service = {
detect: () => checkIsGitRepository(),
config: () => {
return {
// Buildkite doesn't work well so we fallback to git to ensure we have commit and branch
commit: head() || null,
branch: branch() || null,
owner: null,
Expand Down

0 comments on commit 98c8359

Please sign in to comment.