{"id":15552998,"url":"https://github.com/bahmutov/gitlab-build-info","last_synced_at":"2026-05-18T15:08:13.958Z","repository":{"id":66012421,"uuid":"80162015","full_name":"bahmutov/gitlab-build-info","owner":"bahmutov","description":"Grabs GitLab environment variables, great for emails and error messages","archived":false,"fork":false,"pushed_at":"2017-01-30T18:24:34.000Z","size":7,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T23:04:28.036Z","etag":null,"topics":["build","email","environment","gitlab","text"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahmutov.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-26T22:30:19.000Z","updated_at":"2023-09-08T17:19:58.000Z","dependencies_parsed_at":"2023-04-16T10:16:47.483Z","dependency_job_id":null,"html_url":"https://github.com/bahmutov/gitlab-build-info","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bahmutov/gitlab-build-info","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fgitlab-build-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fgitlab-build-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fgitlab-build-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fgitlab-build-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/gitlab-build-info/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fgitlab-build-info/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269748271,"owners_count":24469111,"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-10T02:00:08.965Z","response_time":71,"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":["build","email","environment","gitlab","text"],"created_at":"2024-10-02T14:23:27.355Z","updated_at":"2026-05-18T15:08:08.929Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitlab-build-info\n\n\u003e Grabs GitLab environment variables from the environment\n\n[![NPM][npm-icon] ][npm-url]\n\n[![Build status][ci-image] ][ci-url]\n[![semantic-release][semantic-image] ][semantic-url]\n[![js-standard-style][standard-image]][standard-url]\n\n[GitLab CI](https://about.gitlab.com/gitlab-ci/) has a lot of environment\nvariables, see [the list](https://docs.gitlab.com/ce/ci/variables/#predefined-variables-environment-variables).\nThis module collects the relevant ones into a single object that can also\ngenerate nice text summary suitable for emails / logs\n\n## Install and use\n\n```\nnpm i -D gitlab-build-info\n```\n\nWhile running on GitLab:\n\n```js\nconst grabGitLabInfo = require('gitlab-build-info')\nconst {isOnGitLab, collectionInformation} = grabGitLabInfo()\nif (isOnGitLab) {\n  const info = collectionInformation()\n  // info {specName, buildUrl, ...}\n}\n```\n\nYou can get text summary from the `info` object\n\n```js\nconst msg = info.toString()\n/*\n  returns a string with something like\n\n  ==============================\n   Build information (GitLab)\n  ==============================\n  Project name: my-test\n  Build spec name: test-spec\n  Build ID: 101\n  Build URL: https://server.com/user/test/builds/101\n  Pipeline ID: 550\n  Pipeline URL: https://server.com/user/test/pipelines/550\n  Project URL: https://server.com/user/test\n*/\n```\n\n## Details\n\nSee [src/index.js](src/index.js) for the list of returned properties.\n\nUsually this module checks if there are valid variables on GitLab CI.\nIf you want to skip environment variable checks set environment variable\n`FORCE=1` and the module will return values even if undefined.\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2017\n\n* [@bahmutov](https://twitter.com/bahmutov)\n* [glebbahmutov.com](http://glebbahmutov.com)\n* [blog](http://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/gitlab-build-info/issues) on Github\n\n## MIT License\n\nCopyright (c) 2017 Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt;\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[npm-icon]: https://nodei.co/npm/gitlab-build-info.svg?downloads=true\n[npm-url]: https://npmjs.org/package/gitlab-build-info\n[ci-image]: https://travis-ci.org/bahmutov/gitlab-build-info.svg?branch=master\n[ci-url]: https://travis-ci.org/bahmutov/gitlab-build-info\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: http://standardjs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fgitlab-build-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fgitlab-build-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fgitlab-build-info/lists"}