Skip to content

Commit

Permalink
feat: add travis pr number
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfez committed Jan 2, 2023
1 parent 4512cd9 commit 4b1aad8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/ci-environment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import envCi from "env-ci";
import heroku from "./services/heroku";
import githubActions from "./services/github-actions";
import circleci from "./services/circleci";
import travis from "./services/travis";
import type { CiEnvironment, Options, Context } from "./types";

export { CiEnvironment };

const services = [heroku, githubActions, circleci];
const services = [heroku, githubActions, circleci, travis];

export const envCiDetection = (ctx: Context) => {
const ciContext = envCi(ctx);
Expand Down
22 changes: 22 additions & 0 deletions packages/core/src/ci-environment/services/travis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Service } from "../types";
import { envCiDetection } from "../index";

const service: Service = {
detect: ({ env }) => Boolean(env.TRAVIS),
config: ({ env }) => {
const ciProps = envCiDetection({ env });

return {
name: "Travis CI",
commit: ciProps?.commit || null,
branch: ciProps?.branch || null,
owner: ciProps?.owner || null,
repository: ciProps?.repository || null,
jobId: ciProps?.jobId || null,
runId: ciProps?.runId || null,
prNumber: env.TRAVIS_PULL_REQUEST || null,
};
},
};

export default service;

0 comments on commit 4b1aad8

Please sign in to comment.