{"id":15055452,"url":"https://github.com/shini4i/gitlab-token-scope-adjuster","last_synced_at":"2025-04-10T03:41:00.235Z","repository":{"id":241639146,"uuid":"807297984","full_name":"shini4i/gitlab-token-scope-adjuster","owner":"shini4i","description":"CLI tool for automatically adjusting CI_JOB_TOKEN access scope based on project dependencies in GitLab.","archived":false,"fork":false,"pushed_at":"2025-03-12T06:58:09.000Z","size":130,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T04:51:42.699Z","etag":null,"topics":["automation","devops","gitlab","gitlab-ci","time-saving-tool"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shini4i.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-28T20:46:05.000Z","updated_at":"2025-03-12T06:58:12.000Z","dependencies_parsed_at":"2024-05-29T12:50:32.949Z","dependency_job_id":"57879324-81b9-44a4-896f-06a517b56b36","html_url":"https://github.com/shini4i/gitlab-token-scope-adjuster","commit_stats":null,"previous_names":["shini4i/gitlab-token-scope-adjuster"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fgitlab-token-scope-adjuster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fgitlab-token-scope-adjuster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fgitlab-token-scope-adjuster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fgitlab-token-scope-adjuster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shini4i","download_url":"https://codeload.github.com/shini4i/gitlab-token-scope-adjuster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154963,"owners_count":21056541,"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":["automation","devops","gitlab","gitlab-ci","time-saving-tool"],"created_at":"2024-09-24T21:42:15.733Z","updated_at":"2025-04-10T03:41:00.211Z","avatar_url":"https://github.com/shini4i.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# GitLab CI Job Token Scope Adjuster\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/shini4i/gitlab-token-scope-adjuster/publish.yaml?label=publish)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/shini4i/gitlab-token-scope-adjuster/tests.yaml?label=tests)\n![NPM Downloads](https://img.shields.io/npm/dm/%40shini4i%2Fgitlab-token-scope-adjuster)\n![NPM Version](https://img.shields.io/npm/v/%40shini4i%2Fgitlab-token-scope-adjuster)\n[![codecov](https://codecov.io/github/shini4i/gitlab-token-scope-adjuster/graph/badge.svg?token=ELQ6VQJ0Z5)](https://codecov.io/github/shini4i/gitlab-token-scope-adjuster)\n![GitHub License](https://img.shields.io/github/license/shini4i/gitlab-token-scope-adjuster)\n\n\u003c/div\u003e\n\nThis CLI tool helps automate the process of configuring CI job token scopes in GitLab projects.\n\nStarting from GitLab 16, it is mandatory to explicitly configure `CI_JOB_TOKEN` access, and this tool simplifies that by\nautomating the necessary API calls.\n\n## How it works?\n\n- Fetches project details from GitLab.\n- Identifies dependency files (`go.mod`, `composer.json`, `package-lock.json`) in the repository.\n- Extracts dependencies from these files.\n- Configures CI job token scopes to whitelist the source project in dependency projects.\n\n```mermaid\ngraph LR\n    A[gitlab-token-scope-adjuster -p 1234] --\u003e B[Fetch Project Details]\n    B --\u003e C[Identify Dependency Files]\n    C --\u003e D[Process Each Dependency File]\n    D --\u003e E[Extract Dependencies]\n    E --\u003e F[Whitelist project CI_JOB_TOKEN in the Dependency Project]\n```\n\n## Prerequisites\n\n- Node.js (\u003e= 22.x)\n- ts-node\n- GitLab access token with the necessary permissions\n\n## Installation\n\nInstall [@shini4i/gitlab-token-scope-adjuster](https://www.npmjs.com/package/@shini4i/gitlab-token-scope-adjuster) package:\n\n```sh\nnpm install -g @shini4i/gitlab-token-scope-adjuster\n```\n\n## Usage\n\nExpose the following environment variables:\n\n```sh\nexport GITLAB_URL=https://gitlab.example.com\nexport GITLAB_TOKEN=your_access_token\n```\n\nAnd run the following command:\n\n```sh\ngitlab-token-scope-adjuster -p \u003cyour_project_id\u003e\n```\n\nTo find dependency files recursively run the following command:\n```sh\ngitlab-token-scope-adjuster -p \u003cyour_project_id\u003e --monorepo\n```\n\nKeep in mind that depending on the amount of files in the repo it can significantly increase execution time.\n\nAdditionally, before making changes, it is possible to check which dependency projects would be edited by passing `--dry-run` flag.\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshini4i%2Fgitlab-token-scope-adjuster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshini4i%2Fgitlab-token-scope-adjuster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshini4i%2Fgitlab-token-scope-adjuster/lists"}