{"id":16057880,"url":"https://github.com/ondram/ci-detector-standalone","last_synced_at":"2025-03-18T04:31:16.591Z","repository":{"id":52453174,"uuid":"78222059","full_name":"OndraM/ci-detector-standalone","owner":"OndraM","description":"Standalone CLI command to detect continuous integration server and provide unified access to properties of current build","archived":true,"fork":false,"pushed_at":"2021-04-28T21:38:51.000Z","size":47,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T02:37:02.184Z","etag":null,"topics":["continuous-integration","php","standalone-library"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OndraM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-06T16:45:38.000Z","updated_at":"2025-01-03T12:45:18.000Z","dependencies_parsed_at":"2022-09-01T00:43:25.034Z","dependency_job_id":null,"html_url":"https://github.com/OndraM/ci-detector-standalone","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OndraM%2Fci-detector-standalone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OndraM%2Fci-detector-standalone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OndraM%2Fci-detector-standalone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OndraM%2Fci-detector-standalone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OndraM","download_url":"https://codeload.github.com/OndraM/ci-detector-standalone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244156697,"owners_count":20407555,"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","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":["continuous-integration","php","standalone-library"],"created_at":"2024-10-09T03:05:14.022Z","updated_at":"2025-03-18T04:31:16.235Z","avatar_url":"https://github.com/OndraM.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CI Detector standalone command\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/ondram/ci-detector-standalone.svg?style=flat-square)](https://packagist.org/packages/ondram/ci-detector-standalone)\n[![Build Status](https://img.shields.io/travis/OndraM/ci-detector-standalone.svg?style=flat-square)](https://travis-ci.org/OndraM/ci-detector-standalone)\n[![Coverage Status](https://img.shields.io/coveralls/OndraM/ci-detector-standalone/master.svg?style=flat-square)](https://coveralls.io/github/OndraM/ci-detector-standalone?branch=master)\n\nStandalone CLI command wrapper for [ci-detector] PHP library.\n\nIt is used to detect continuous integration environment and to provide a unified interface to read the build information.\nYou can use the command to make your scripts (and especially CLI tools) portable for  multiple build environments.\n\nThe detection is based on environment variables injected to the build environment by continuous integration \nserver. However, these variables are named differently in each CI. **This command is based on lightweight\n[ci-detector] PHP library**, which provides adapter for each supported\nCI server.\n\nIf you need the detection inside PHP script (so you don't need the CLI command), you can just use directly\nthe [ci-detector] library.\n\nReleases are matched to the versions of the parent [ci-detector] library.\nSee [changelog](https://github.com/OndraM/ci-detector/blob/master/CHANGELOG.md) there for the list of the latest changes.\n\n## Usage\n\n```sh\n$ ./ci-detector.phar # return status code 0 if CI detected, 1 otherwise\n$ echo $? # to print status code of previous command\n0\n\n$ ./ci-detector.phar detect ci-name\nTravis CI\n\n$ ./ci-detector.phar detect build-number\n11.3\n\n$ ./ci-detector.phar detect build-url\nhttps://travis-ci.org/OndraM/ci-detector-standalone/jobs/189809581\n\n$ ./ci-detector.phar detect branch\nfeature/test\n\n$ ./ci-detector.phar detect commit\nf45e5809cefdbb819913f9357381f4d291fd49a9\n\n$ ./ci-detector.phar detect repository-url # Not supported on Travis CI, will print empty string\n\n$ ./ci-detector.phar detect is-pull-request\nYes\n\n$ ./ci-detector.phar detect branch\nmain\n```\n\nSee [method reference] for a documentation of each property.\n\n## Dump all available properties\n\n`dump` command will show all properties detected in current environment by ci-detector:\n\n```sh\n$ ./ci-detector.phar dump\n+-----------------+---------------------------------------------------------------+\n| Property name   | Current value                                                 |\n+-----------------+---------------------------------------------------------------+\n| ci-name         | Travis CI                                                     |\n| build-number    | 164.1                                                         |\n| build-url       | https://travis-ci.org/OndraM/ci-detector-standalone/jobs/1337 |\n| commit          | 9b232f6813915ddb1f226de93366cb924c72e400                      |\n| branch          | feature/dump-command                                          |\n| target-branch   | main                                                          |\n| repository-name | ondram/ci-detector                                            |\n| repository-url  | ssh://git@gitserver:7999/project/repo.git                     |\n| is-pull-request | Yes                                                           |\n+-----------------+---------------------------------------------------------------+\n```\n\nThis is basically a table with output of `describe()` method of `CiInterface` (see [method reference]).\n\n## Installation\n\n### Install as a standalone PHAR file\nCI Detector could be installed as a standalone executable PHAR file (`ci-detector.phar`).\nDownload latest version from [Releases page](https://github.com/OndraM/ci-detector-standalone/releases/latest).\n\nTo run CI Detector use command  `./ci-detector.phar` in the directory where you saved the file (or `php ci-detector.phar` if the\nfile itself is not executable).\n\n### Install using [Composer](https://getcomposer.org/)\n\n```sh\n$ composer require ondram/ci-detector-standalone\n```\n\nTo run CI Detector use command `vendor/bin/ci-detector`.\n\nIf you need the detection inside PHP script (and you don't need the CLI command), you can just use directly\nthe lightweight [ci-detector] library.\n\n[ci-detector]: https://github.com/OndraM/ci-detector\n[method reference]: https://github.com/OndraM/ci-detector#api-methods-reference\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fondram%2Fci-detector-standalone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fondram%2Fci-detector-standalone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fondram%2Fci-detector-standalone/lists"}