{"id":19650912,"url":"https://github.com/un-ts/changesets-gitlab","last_synced_at":"2025-04-28T16:31:00.627Z","repository":{"id":39456740,"uuid":"392922371","full_name":"un-ts/changesets-gitlab","owner":"un-ts","description":"GitLab CI cli for changesets like its GitHub Action.","archived":false,"fork":false,"pushed_at":"2025-04-15T05:42:29.000Z","size":2428,"stargazers_count":105,"open_issues_count":6,"forks_count":39,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-24T13:10:32.313Z","etag":null,"topics":["changeset","changesets","gitlab"],"latest_commit_sha":null,"homepage":"https://opencollective.com/changesets-gitlab","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/un-ts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":["JounQin","1stG","rx-ts","un-ts"],"patreon":"1stG","open_collective":"unts","custom":["https://opencollective.com/1stG","https://opencollective.com/rxts","https://afdian.net/@JounQin"]}},"created_at":"2021-08-05T06:03:11.000Z","updated_at":"2025-04-15T05:42:03.000Z","dependencies_parsed_at":"2023-12-23T13:03:11.628Z","dependency_job_id":"caf6b805-4c68-4882-921e-071179c0882e","html_url":"https://github.com/un-ts/changesets-gitlab","commit_stats":{"total_commits":126,"total_committers":21,"mean_commits":6.0,"dds":0.7619047619047619,"last_synced_commit":"54e3175ad30a3819b9e9610d72cfe0ea1e68760b"},"previous_names":["rx-ts/changesets-gitlab"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un-ts%2Fchangesets-gitlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un-ts%2Fchangesets-gitlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un-ts%2Fchangesets-gitlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/un-ts%2Fchangesets-gitlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/un-ts","download_url":"https://codeload.github.com/un-ts/changesets-gitlab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251141844,"owners_count":21542431,"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":["changeset","changesets","gitlab"],"created_at":"2024-11-11T15:03:55.264Z","updated_at":"2025-04-28T16:31:00.618Z","avatar_url":"https://github.com/un-ts.png","language":"TypeScript","readme":"# changesets-gitlab\n\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/changesets-gitlab/ci.yml?branch=main)](https://github.com/un-ts/changesets-gitlab/actions/workflows/ci.yml?query=branch%3Amain)\n[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/changesets-gitlab)](https://coderabbit.ai)\n[![npm](https://img.shields.io/npm/v/changesets-gitlab.svg)](https://www.npmjs.com/package/changesets-gitlab)\n[![GitHub Release](https://img.shields.io/github/release/un-ts/changesets-gitlab)](https://github.com/un-ts/changesets-gitlab/releases)\n\n[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)\n\nGitLab CI cli for [changesets](https://github.com/atlassian/changesets) like its [GitHub Action](https://github.com/changesets/action), it creates a merge request with all of the package versions updated and changelogs updated and when there are new changesets on master, the MR will be updated. When you're ready, you can merge the merge request and you can either publish the packages to npm manually or setup the action to do it for you.\n\n## Usage\n\n### Inputs\n\n\u003e Note: environment variables are case-sensitive\n\n- `INPUT_PUBLISH` - The command to use to build and publish packages\n- `INPUT_VERSION` - The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided\n- `INPUT_COMMIT` - The commit message to use. Default to `Version Packages`\n- `INPUT_TITLE` - The merge request title. Default to `Version Packages`\n\n#### Only available in `changesets-gitlab`\n\n- `INPUT_PUBLISHED` - Command executed after published\n- `INPUT_ONLY_CHANGESETS` - Command executed on only changesets detected\n- `INPUT_REMOVE_SOURCE_BRANCH` - Enables the merge request \"Delete source branch\" checkbox. Default false.\n- `INPUT_TARGET_BRANCH` -\u003e The merge request target branch. Defaults to current branch\n- `INPUT_CREATE_GITLAB_RELEASES` - A boolean value to indicate whether to create Gitlab releases after publish or not. Default true.\n- `INPUT_LABELS` - A comma separated string of labels to be added to the version package Gitlab Merge request\n\n### Outputs\n\n- `PUBLISHED` - A boolean value to indicate whether a publishing is happened or not\n- `PUBLISHED_PACKAGES` - A JSON array to present the published packages. The format is `[{\"name\": \"@xx/xx\", \"version\": \"1.2.0\"}, {\"name\": \"@xx/xy\", \"version\": \"0.8.9\"}]`\n\n### Environment Variables\n\n```sh\nGLOBAL_AGENT_HTTP_PROXY  # optional, if you're using custom GitLab service under proxy\nGLOBAL_AGENT_HTTPS_PROXY # As above but for https requests\nGLOBAL_AGENT_NO_PROXY    # Like above but for no proxied requests\n\n# http_proxy, https_proxy, no_proxy environment variables are supported at the same time\n\nGITLAB_HOST # optional, if you're using custom GitLab host, will fallback to `CI_SERVER_URL` if not provided\n\nGITLAB_TOKEN                           # required, token with accessibility to push, package registries, and merge request APIs. Note the CI_JOB_TOKEN does not have sufficient permissions\nGITLAB_TOKEN_TYPE                      # optional, type of the provided token in GITLAB_TOKEN. defaults to personal access token. Can be `oauth` if you use Gitlab Oauth (personal access) token\nGITLAB_CI_USER_NAME                    # optional, username with accessibility to push, used in pairs of the above token (if it was personal access token). If not set read it from the Gitlab API\nGITLAB_CI_USER_EMAIL                   # optional, default `gitlab[bot]@users.noreply.gitlab.com`\nGITLAB_COMMENT_TYPE                    # optional, type of the comment. defaults to `discussion`. can be set to `note` to not create a discussion instead of a thread\nGITLAB_COMMENT_DISCUSSION_AUTO_RESOLVE # optional, automatically resolve added discussion when changeset is present, if you want to always resolve the discussion, you should actually use `GITLAB_COMMENT_TYPE=note` instead, default `true`\nGITLAB_COMMENT_CUSTOM_LINKS            # optional, override the links content referenced in the cli bot comment, use {{ addChangesetUrl }} placeholder for the dynamic URL to add a changeset\nGITLAB_ADD_CHANGESET_MESSAGE           # optional, default commit message for adding changesets on GitLab Web UI\nDEBUG_GITLAB_CREDENTIAL                # optional, whether to log when setting remote url with sensitive `token` displayed\n```\n\n### Example workflow\n\n#### Without Publishing\n\nCreate a file at `.gitlab-ci.yml` with the following content.\n\n```yml\nstages:\n  - comment\n  - release\n\nbefore_script: yarn --frozen-lockfile\n\ncomment:\n  image: node:lts-alpine\n  stage: comment\n  rules:\n    - if: $CI_PIPELINE_SOURCE == \"merge_request_event\"\n  script: yarn changesets-gitlab comment # comment automatically like https://github.com/changesets/bot\n\nrelease:\n  image: node:lts-alpine\n  rules:\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n  script: yarn changesets-gitlab\n```\n\n#### With Publishing\n\nBefore you can setup this action with publishing, you'll need to have an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) that can publish the packages in the repo you're setting up the action for and doesn't have 2FA on publish enabled ([2FA on auth can be enabled](https://docs.npmjs.com/about-two-factor-authentication)). You'll also need to [add it as a custom environment variable on your GitLab repo](https://docs.gitlab.com/ee/ci/variables/#custom-cicd-variables) with the name `NPM_TOKEN`. Once you've done that, you can create a file at `.gitlab-ci.yml` with the following content.\n\n```yml\nstages:\n  - comment\n  - release\n\nbefore_script: yarn --frozen-lockfile\n\ncomment:\n  image: node:lts-alpine\n  stage: comment\n  rules:\n    - if: $CI_PIPELINE_SOURCE == \"merge_request_event\"\n  script: yarn changesets-gitlab comment\n\nrelease:\n  image: node:lts-alpine\n  rules:\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n  script: yarn changesets-gitlab\n  variables:\n    INPUT_PUBLISH: yarn release\n```\n\nBy default the GitLab CI cli creates a `.npmrc` file with the following content:\n\n```sh\n//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n```\n\nHowever, if a `.npmrc` file is found, the GitLab CI cli does not recreate the file. This is useful if you need to configure the `.npmrc` file on your own.\nFor example, you can add a step before running the Changesets GitLab CI cli:\n\n```yml\nscript: |\n  cat \u003c\u003c EOF \u003e \"$HOME/.npmrc\"\n    email=my@email.com\n    //registry.npmjs.org/:_authToken=$NPM_TOKEN\n  EOF\n```\n\n#### With version script\n\nIf you need to add additional logic to the version command, you can do so by using a version script.\n\nIf the version script is present, this action will run that script instead of `changeset version`, so please make sure that your script calls `changeset version` at some point. All the changes made by the script will be included in the MR.\n\n```yml\nstages:\n  - comment\n  - release\n\nbefore_script: yarn --frozen-lockfile\n\ncomment:\n  image: node:lts-alpine\n  stage: comment\n  rules:\n    - if: $CI_PIPELINE_SOURCE == \"merge_request_event\"\n  script: yarn changesets-gitlab comment\n\nrelease:\n  image: node:lts-alpine\n  rules:\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n  script: yarn changesets-gitlab\n  variables:\n    INPUT_VERSION: yarn version\n```\n\n#### With Yarn 2 / Plug'n'Play\n\nIf you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI:\n\n```yml\nstages:\n  - comment\n  - release\n\nbefore_script: yarn --frozen-lockfile\n\ncomment:\n  image: node:lts-alpine\n  stage: comment\n  rules:\n    - if: $CI_PIPELINE_SOURCE == \"merge_request_event\"\n  script: yarn changesets-gitlab comment\n\nrelease:\n  image: node:lts-alpine\n  rules:\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n  script: yarn changesets-gitlab\n  variables:\n    INPUT_VERSION: yarn changeset version\n```\n\nYou may also want to run `yarn install` after the `changeset verion` command to update the `yarn.lock` in the version MR. You need to disable immutable lock file setting using an env variable:\n\n```yml\nrelease:\n  image: node:lts-alpine\n  rules:\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n  script: yarn changesets-gitlab\n  variables:\n    YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'\n    INPUT_VERSION: yarn update-versions\n```\n\nAnd your `update-versions` script would be:\n\n```json\n{\n  \"update-versions\": \"changeset version \u0026\u0026 yarn install\"\n}\n```\n\n## Sponsors\n\n| 1stG                                                                                                                               | RxTS                                                                                                                               | UnTS                                                                                                                               |\n| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |\n\n## Backers\n\n[![Backers](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)\n\n| 1stG                                                                                                                             | RxTS                                                                                                                             | UnTS                                                                                                                             |\n| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |\n\n## Changelog\n\nDetailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).\n\n## License\n\n[MIT][] © [JounQin][]@[1stG.me][]\n\n[1stG.me]: https://www.1stG.me\n[JounQin]: https://github.com/JounQin\n[MIT]: http://opensource.org/licenses/MIT\n","funding_links":["https://github.com/sponsors/JounQin","https://github.com/sponsors/1stG","https://github.com/sponsors/rx-ts","https://github.com/sponsors/un-ts","https://patreon.com/1stG","https://opencollective.com/unts","https://opencollective.com/1stG","https://opencollective.com/rxts","https://afdian.net/@JounQin"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun-ts%2Fchangesets-gitlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fun-ts%2Fchangesets-gitlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun-ts%2Fchangesets-gitlab/lists"}