{"id":13685242,"url":"https://github.com/streamich/cross-ci","last_synced_at":"2025-08-12T08:07:00.614Z","repository":{"id":66051552,"uuid":"133189916","full_name":"streamich/cross-ci","owner":"streamich","description":"Travis, CircleCI, et. al. env vars normalized","archived":false,"fork":false,"pushed_at":"2023-05-18T12:15:33.000Z","size":90,"stargazers_count":14,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T01:38:16.831Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-12T23:11:33.000Z","updated_at":"2024-10-25T03:45:48.000Z","dependencies_parsed_at":"2024-01-14T18:09:20.552Z","dependency_job_id":null,"html_url":"https://github.com/streamich/cross-ci","commit_stats":{"total_commits":80,"total_committers":4,"mean_commits":20.0,"dds":"0.21250000000000002","last_synced_commit":"ef52a55c3297648100b1b2bb0d3d534a92436fd0"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/cross-ci","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcross-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcross-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcross-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcross-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/cross-ci/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcross-ci/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T14:00:47.335Z","updated_at":"2025-08-12T08:07:00.588Z","avatar_url":"https://github.com/streamich.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# cross-ci\n\n`cross-ci` standardizes environment variables for CI. For example,\nyour can simply use `BUILD_BRANCH` variable in all CI runners instead of `CIRCLE_BRANCH` in\nCircleCI or `TRAVIS_PULL_REQUEST_BRANCH` in Travis.\n\n##### Install\n\n```\nnpm i cross-ci\n```\n\n##### Node usage\n\n```js\nconst vars = require('cross-ci').vars;\n```\n\n##### CLI usage\n\n```\nnpx cross-ci printenv BUILD_COMMIT_URL\n```\n\n## Variables\n\n- [`BUILD_BRANCH`](#build_branch)\n- [`BUILD_COMMIT_PR_URL`](#build_commit_pr_url)\n- [`BUILD_COMMIT_URL`](#build_commit_url)\n- [`BUILD_COMMIT`](#build_commit)\n- [`BUILD_COMMIT7`](#build_commit7)\n- [`BUILD_DIR`](#build_dir)\n- [`BUILD_NUM`](#build_num)\n- [`BUILD_PR_NUM`](#build_pr_num)\n- [`BUILD_PR_URL`](#build_pr_url)\n- [`BUILD_URL`](#build_url)\n- [`BUILD_VERSION`](#build_version)\n- [`CI_NAME`](#ci_name)\n- [`CI_PLATFORM`](#ci_platform)\n- [`GIT_PLATFORM`](#git_platform)\n- [`GIT_REMOTE`](#git_remote)\n- [`GITHUB_TOKEN`](#github_token)\n- [`IS_CI`](#is_ci)\n- [`IS_PR`](#is_pr)\n- [`IS_RELEASE`](#is_release)\n- [`JOB_NUM`](#job_num)\n- [`JOB_URL`](#job_url)\n- [`MONTH`](#month)\n- [`PROJECT_NAME`](#project_name)\n- [`PROJECT_OWNER`](#project_owner)\n- [`PROJECT_URL`](#project_url)\n- [`PROJECT_VERSION`](#project_version)\n- [`RELEASE_BRANCHES`](#release_branches)\n- [`TIME`](#time)\n- [`TIMESTAMP`](#timestamp)\n- [`UPLOAD_PATH`](#upload_path)\n- [`YEAR`](#year)\n\n\n\n\n## Pseudo Commands\n\n##### `:echo`\n\n```shell\nnpx cross-ci :echo node --eval \"\\\"console.log('\\${PROJECT_NAME}')\\\"\"\n```\n\n##### `:run`\n\n```shell\nnpx cross-ci :run node --eval \"\\\"console.log('\\${PROJECT_NAME}')\\\"\"\n```\n\n## Examples\n\n##### Provide Evn Vars to Webpack, from `package.json`\n\n```json\n{\n    \"scripts\": {\n        \"build\": \"cross-ci webpack -p\"\n    }\n}\n```\n\n##### Update GitHub status\n\n```shell\nnpx cross-ci :run \\\n    npx commit-status success Storybook \"'\\${BUILD_VERSION}'\" \"'https://example.com'\"\n```\n\n##### Upload to S3\n\n```shell\nnpx cross-ci :run \\\n    s3 sync ./public \"s3://bucket/builds/\\${PROJECT_NAME}/\\${BUILD_VERSION}/public\" \\\n        --region eu-west-1 \\\n        --acl public-read\n```\n\n##### Post to Slack\n\n```shell\nnpx cross-ci :run \\\n    curl -X POST -H 'Content-type: application/json' \\\n        --data \"'{\\\n            \\\"text\\\":\\\"Built \\\\\\`\u003c\\${PROJECT_URL}|\\${PROJECT_NAME}\u003e\\\\\\` :crossed_fingers: \\\\\\`\u003c\\${BRANCH_URL}|\\${BUILD_BRANCH}\u003e\\\\\\` :crossed_fingers: \\\\\\`\\${BUILD_VERSION}\\\\\\` on \u003c\\${BUILD_URL}|\\${CI_NAME}\u003e :tada:\\\", \\\n            \\\"username\\\": \\\"cross-ci\\\", \\\n            \\\"icon_emoji\\\": \\\":clap:\\\"}'\" \\\n        https://hooks.slack.com/services/XXXX/XXXX/XXXXXXXX\n```\n\n##### Post to GitHub\n\n```shell\nGITHUB_TOKEN=XXXXXXXX \\\n    npx cross-ci :run \\\n        curl -X POST -H \"Content-Type: application/json\" \\\n            --data \"'{\\\"body\\\": \\\"Build version: \\\\\\`\\${BUILD_VERSION}\\\\\\` :crossed_fingers: [\\\\\\`\\${BUILD_BRANCH}\\\\\\`](\\${BRANCH_URL}) on [\\${CI_NAME}](\\${BUILD_URL}) :tada:\\\"}'\" \\\n        \"https://api.github.com/repos/\\${PROJECT_OWNER}/\\${PROJECT_NAME}/issues/\\${BUILD_PR_NUM}/comments?access_token=\\${GITHUB_TOKEN}\"\n```\n\n## Variable Reference\n\n\n\n#### `BUILD_BRANCH`\n\n\n\nGit branch being built or targeted by a pull request.\n\n\n\n#### `BUILD_COMMIT_PR_URL`\n\nURL of PR build commit.\n\n\n\n#### `BUILD_COMMIT_URL`\n\nURL of build commit.\n\n\n\n#### `BUILD_COMMIT`\n\n\n\nSHA1 of the Git commit being built.\n\n\n\n#### `BUILD_COMMIT7`\n\n\n\nFirst 7 chars of SHA1 of the Git commit being built.\n\n\n\n#### `BUILD_DIR`\n\n\n\nPath to repository folder.\n\n\n\n#### `BUILD_NUM`\n\n\n\nCI service build number.\n\n\n\n#### `BUILD_PR_NUM`\n\n\n\nPull request (aka Merge request) number. Defaults to `0`.\n\n\n\n#### `BUILD_PR_URL`\n\nURL to GitHub PR page.\n\n\n\n#### `BUILD_URL`\n\n\n\nURL to CI build page.\n\n\n\n#### `BUILD_VERSION`\n\nA human-readable string uniquely identifying current build.\nFor pull requests will equal to something like `x.y.z-pr-1.1`.\nFor build jobs that are not part of a pull request,\nit will contain a branch name, like `x.y.z-master.1`.\n\n\n\n#### `CI_NAME`\n\n\n\nCI service Commercial name (e.g. `Travis`, `CircleCI`, `TeamCity`).\n\n\n\n#### `CI_PLATFORM`\n\n\n\nStandardized CI service name (e.g. `travis`, `circle`, `gitlab`).\n\n\n\n#### `GIT_PLATFORM`\n\n\n\nGit version control system used\n\n\n\n#### `GIT_REMOTE`\n\nGit remote used.\n\n\n\n#### `GITHUB_TOKEN`\n\nEquals to `GITHUB_TOKEN`, `GITHUB_ACCESS_TOKEN`, `GH_TOKEN`, or `GIT_CREDENTIALS` environment variables, in that order.\n\n\n\n#### `IS_CI`\n\n\n\nBoolean indicating if script runs in a CI environment.\n\n\n\n#### `IS_PR`\n\n\n\nBoolean, `true` if the current build is triggered by a pull request.\n\n\n\n#### `IS_RELEASE`\n\nIs `true` if currently built branch is one of `RELEASE_BRANCHES`.\n\n\n\n#### `JOB_NUM`\n\nCI service job number\n\n\n\n#### `JOB_URL`\n\nLink to the CI service job\n\n\n\n#### `MONTH`\n\nCurrent month numeric value as a string of length two.\n\n\n\n#### `PROJECT_NAME`\n\n\n\nGitHub project name.\n\n\n\n#### `PROJECT_OWNER`\n\n\n\nUser name or organization name that owns the repository.\n\n\n\n#### `PROJECT_URL`\n\nLink to project on GitHub.\n\n\n\n#### `PROJECT_VERSION`\n\nSemver version of your project. Taken from `package.json`. Othewise\ndefaults to `0.0.0`.\n\n\n\n#### `RELEASE_BRANCHES`\n\nNames of branches which should trigger a release,\ndefaults to `['master', 'production']`.\n\n\n\n#### `TIME`\n\nCurrent time in UTC format.\n\n\n\n#### `TIMESTAMP`\n\nUNIX timestamp.\n\n\n\n#### `UPLOAD_PATH`\n\nRelative upload path for artifacts. Defaults to:\n\n```\nbuilds/${PROJECT_NAME}/${BUILD_VERSION}\n```\n\n\n\n#### `YEAR`\n\nCurrent year as a four character long string.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcross-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Fcross-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcross-ci/lists"}