Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support bitrise ci #89

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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