un-ts / changesets-gitlab Goto Github PK
View Code? Open in Web Editor NEWGitLab CI cli for changesets like its GitHub Action.
Home Page: https://opencollective.com/unts/projects/changesets-gitlab
License: MIT License
GitLab CI cli for changesets like its GitHub Action.
Home Page: https://opencollective.com/unts/projects/changesets-gitlab
License: MIT License
Hello -
I'm not sure if this is an actual issue, probably something I have incorrectly setup in my use of changesets-gitlab
. If you could provide any guidance it would be appreciated though, I've tried numerous things but no luck :)
#gitlab-ci.yml
comment:
stage: comment
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
script:
- npm install
- npx changesets-gitlab comment
variables:
GITLAB_TOKEN: $GITLAB_TOKEN
GITLAB_CI_USER_NAME: $GITLAB_CI_USER_NAME
DEBUG_GITLAB_CREDENTIAL: 'true'
The problem is running the comment
job in Gitlab produces a 401 error:
HTTPError: Response code 401 (Unauthorized)
at Request.<anonymous> (/builds/zywave/content/playground/web-components/content-components/node_modules/got/dist/source/as-promise/index.js:118:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1662857996689,
socket: 1662857996693,
lookup: 1662857996694,
connect: 1662857996854,
secureConnect: 1662857997215,
upload: 1662857997215,
response: 1662857997309,
end: 1662857997312,
error: undefined,
abort: undefined,
phases: {
wait: 4,
dns: 1,
tcp: 1[60](https://gitlab.com/zywave/content/playground/web-components/content-components/-/jobs/3010216532#L60),
tls: 3[61](https://gitlab.com/zywave/content/playground/web-components/content-components/-/jobs/3010216532#L61),
request: 0,
firstByte: 94,
download: 3,
total: [62](https://gitlab.com/zywave/content/playground/web-components/content-components/-/jobs/3010216532#L62)3
}
},
description: '401 Unauthorized'
}
I setup GITLAB_TOKEN
as a Personal Access Token, from my own user and have them defined as project CI/CD variables. My user has Owner
privileges on the project. As a sanity check I made another Personal Access Token and updated project variable, still hitting the same snag. Also the project is under a private group, not sure if additional config is needed for that.
If you would like more information please let me know, happy to provide, and thank you for the help!
If there is a commit in a branch with open Merge Request and a "No Changeset found" comment is already there, the application should not add another one. It quickly gets confusing with all the other comments.
I think the switchToMaybeExistingBranch
logic is wrong as it checks for a very specific git phrase. We need to make it more general.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These problems occurred while renovating this repository. View logs.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
micromatch
, @types/micromatch
).github/workflows/ci.yml
actions/checkout v4
actions/setup-node v4
.github/workflows/release.yml
actions/checkout v4
actions/setup-node v4
package.json
@actions/core ^1.10.1
@actions/exec ^1.1.1
@changesets/assemble-release-plan ^5.2.4
@changesets/config ^2.3.1
@changesets/errors ^0.1.4
@changesets/parse ^0.3.16
@changesets/pre ^1.0.14
@changesets/read ^0.5.9
@gitbeaker/rest ^39.23.0
@manypkg/get-packages ^1.1.3
@sentry/node ^7.80.1
commander ^11.1.0
dotenv ^16.3.1
fs-extra ^11.1.1
global-agent ^3.0.0
human-id ^4.1.0
js-yaml ^4.1.0
markdown-table ^3.0.3
mdast-util-to-string ^4.0.0
micromatch ^4.0.5
remark-parse ^11.0.0
remark-stringify ^11.0.0
resolve-from ^5.0.0
semver ^7.5.4
unified ^11.0.4
@1stg/lib-config ^12.0.1
@changesets/changelog-github ^0.4.8
@changesets/cli ^2.26.2
@types/global-agent ^2.1.3
@types/jest ^29.5.11
@types/js-yaml ^4.0.9
@types/micromatch ^4.0.6
@types/web ^0.0.128
jest ^29.7.0
ts-jest ^29.1.1
ts-node ^10.9.2
type-coverage ^2.27.0
typescript ^5.3.3
yarn-deduplicate ^6.0.2
node >=18.0.0
Are there any plans to support monorepos like Turborepo on the roadmap?
I tried a lot of solutions, but in the end they didn't work. Can you help me?
.gitlab-ci.yml
stages:
- install
- lint
- comment
- release
image: node:16.20.0
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
- "**/node_modules/"
- node_modules/
before_script: &global_before_script
- corepack enable
- corepack prepare pnpm@latest-7 --activate
- pnpm config set store-dir .pnpm-store
install:
stage: install
before_script:
- *global_before_script
- pnpm config set registry https://registry.npmmirror.com/
script:
- pnpm install # install dependencies
tags:
- builder-wxh
only: &common_only
- master
- /^feature\/.*$/
- /^hotfix\/.*$/
- merge_requests
lint:
stage: lint
script:
- npm run lint # lint code
only: *common_only
tags:
- builder-wxh
pre_compile:
stage: lint
tags:
- builder-wxh
script:
- npm run build # compile code
only: *common_only
comment:
stage: comment
tags:
- builder-wxh
only:
- merge_requests
# comment automatically like https://github.com/changesets/bot
script: pnpm dlx changesets-gitlab comment
create_MR:
stage: release
tags:
- builder-wxh
when: manual
variables:
GITLAB_TOKEN: $CI_JOB_TOKEN
INPUT_PUBLISH: npm run build
INPUT_TITLE: "chore(release): publish"
TARGET_BRANCH: refactor # TODO: change to master
script:
- |
cat << EOF > "$HOME/.npmrc"
email = [email protected]
//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}
EOF
- echo "Created the following .npmrc:"; cat "$HOME/.npmrc"
- pnpm dlx changesets-gitlab
only: *common_only
except:
- merge_requests
�[0KRunning with gitlab-runner 16.0.2 (85586bd1)�[0;m
�[0K on builder-wxh _5z-vVyu6, system ID: s_6965a954eb78�[0;m
section_start:1691047484:prepare_executor
�[0K�[0K�[36;1mPreparing the "docker" executor�[0;m�[0;m
�[0KUsing Docker executor with image node:16.20.0 ...�[0;m
�[0KPulling docker image node:16.20.0 ...�[0;m
�[0KUsing docker image sha256:c56ec223ce193f5e085a073b727aa63e01f1d31f9d9b5baddab4523389db5f6d for node:16.20.0 with digest node@sha256:07ac708c46cc7136db9d54749c541ba1dc516dc316e126a94136083b842c2db9 ...�[0;m
section_end:1691047487:prepare_executor
�[0Ksection_start:1691047487:prepare_script
�[0K�[0K�[36;1mPreparing environment�[0;m�[0;m
Running on runner-5z-vvyu6-project-31-concurrent-0 via szq-ubuntu...
section_end:1691047488:prepare_script
�[0Ksection_start:1691047488:get_sources
�[0K�[0K�[36;1mGetting source from Git repository�[0;m�[0;m
�[32;1mFetching changes with git depth set to 20...�[0;m
Reinitialized existing Git repository in /builds/common-editor-toolkit/editor/.git/
�[32;1mChecking out 263b27a5 as detached HEAD (ref is feature/ci)...�[0;m
Removing .pnpm-store/
Removing node_modules/
Removing packages/browser/node_modules/
Removing packages/components-pro/node_modules/
Removing packages/components/node_modules/
Removing packages/core/node_modules/
Removing packages/desktop/node_modules/
Removing playground/node_modules/
�[32;1mSkipping Git submodules setup�[0;m
section_end:1691047491:get_sources
�[0Ksection_start:1691047491:restore_cache
�[0K�[0K�[36;1mRestoring cache�[0;m�[0;m
�[32;1mChecking cache for 0_pnpm-lock-91d8e5d408686549482d3a90dde9877a734df4bb-non_protected...�[0;m
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.�[0;m
�[0;33mWARNING: node_modules/.pnpm/@[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-dom/node_modules/: mkdir node_modules/.pnpm/@[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-dom: file exists (suppressing repeats)�[0;m
�[32;1mSuccessfully extracted cache�[0;m
section_end:1691047505:restore_cache
�[0Ksection_start:1691047505:step_script
�[0K�[0K�[36;1mExecuting "step_script" stage of the job script�[0;m�[0;m
�[0KUsing docker image sha256:c56ec223ce193f5e085a073b727aa63e01f1d31f9d9b5baddab4523389db5f6d for node:16.20.0 with digest node@sha256:07ac708c46cc7136db9d54749c541ba1dc516dc316e126a94136083b842c2db9 ...�[0;m
�[32;1m$ corepack enable�[0;m
�[32;1m$ corepack prepare pnpm@latest-7 --activate�[0;m
Preparing pnpm@latest-7 for immediate activation...
�[32;1m$ pnpm config set store-dir .pnpm-store�[0;m
�[32;1m$ cat << EOF > "$HOME/.npmrc" # collapsed multi-line command�[0;m
�[32;1m$ echo "Created the following .npmrc:"; cat "$HOME/.npmrc"�[0;m
Created the following .npmrc:
email = [email protected]
//git.aquilainteractive.cn/api/v4/projects/31/packages/npm/:_authToken=[MASKED]
�[32;1m$ pnpm dlx changesets-gitlab�[0;m
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 1, reused 0, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 8, reused 8, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | WARN deprecated @gitbeaker/[email protected]
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 20, reused 20, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 23, reused 23, downloaded 0, added 0
WARN GET https://registry.npmjs.org/@changesets%2Fread error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
WARN GET https://registry.npmjs.org/@sentry%2Fnode error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
WARN GET https://registry.npmjs.org/@changesets%2Ferrors error (ERR_SOCKET_TIMEOUT). Will retry in 10 seconds. 2 retries left.
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 24, reused 23, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 25, reused 25, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 28, reused 28, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 44, reused 43, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 59, reused 59, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 92, reused 92, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 117, reused 117, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 153, reused 150, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 190, reused 190, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 226, reused 226, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 235, reused 235, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 239, reused 238, downloaded 0, added 0
../../.pnpm-store/v3/tmp/dlx-59 | +239 ++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /builds/.pnpm-store/v3
Virtual store is at: ../../.pnpm-store/v3/tmp/dlx-59/node_modules/.pnpm
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name Wu Xiaohong
[command]/usr/bin/git config user.email "gitlab[bot]@users.noreply.gitlab.com"
setting GitLab credentials
../../.pnpm-store/v3/tmp/dlx-59 | Progress: resolved 239, reused 239, downloaded 0, added 239, done
HTTPError: Response code 401 (Unauthorized)
at Request. (/builds/.pnpm-store/v3/tmp/dlx-59/node_modules/.pnpm/[email protected]/node_modules/got/dist/source/as-promise/index.js:118:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 1691047607638,
socket: 1691047607639,
lookup: 1691047607640,
connect: 1691047607833,
secureConnect: 1691047608278,
upload: 1691047608278,
response: 1691047608635,
end: 1691047608641,
error: undefined,
abort: undefined,
phases: {
wait: 1,
dns: 1,
tcp: 193,
tls: 445,
request: 0,
firstByte: 357,
download: 6,
total: 1003
}
},
description: '401 Unauthorized'
}
ERROR Command failed with exit code 1: /builds/.pnpm-store/v3/tmp/dlx-59/node_modules/.bin/changesets-gitlab
pnpm: Command failed with exit code 1: /builds/.pnpm-store/v3/tmp/dlx-59/node_modules/.bin/changesets-gitlab
at makeError (/root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:22289:17)
at handlePromise (/root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:22860:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.handler [as dlx] (/root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:191714:7)
at async /root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:199078:21
at async run (/root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:199049:34)
at async runPnpm (/root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:199270:5)
at async /root/.cache/node/corepack/pnpm/7.9.5/dist/pnpm.cjs:199262:7
section_end:1691047609:step_script
�[0Ksection_start:1691047609:cleanup_file_variables
�[0K�[0K�[36;1mCleaning up project directory and file based variables�[0;m�[0;m
section_end:1691047609:cleanup_file_variables
�[0K�[31;1mERROR: Job failed: exit code 1
�[0;m
In our GitLab, the query strings are ignored. When I click the link which looks like {BASE}/new/gzip?file_name=.changeset/ninety-parrots-divide.md&file=---%0A%22%40zazuko%2Fmymuseum-pipeline%22%3A%20patch%0A---%0A%0Afeat%3A%20gzipping%20output%0A
The editor opens blank
Hey!
Recently updated from version 0.5.5 to 0.8.0 and noticed that GitLab releases were no longer being created upon deployment. Explicitly adding:
publish:
variables:
INPUT_CREATE_GITLAB_RELEASES: "true"
fixed it, and releases are getting created again.
Looks like the value isn't defaulted to true anymore, as is stated in the docs.
https://github.com/un-ts/changesets-gitlab/blob/main/src/main.ts#L90
There is a ticket on changeset itself to "fix" this, but since the ticket is 1,5 years open, maybe there is chance to implement a own publish command in this lib, since its handling gitlab already.
Problem is changesets doesnt detect packages on the gitlab package registry or gives wrong output.
Right now, the MR is created with the target branch being the same as the one that's running the CI.
In our case, we use a branch dev
for development and we'd like to merge all changes into main
using the MR that changeset created. Problem is as I said, the target branch is always dev
as it's using CI_COMMIT_REF_NAME
. Could an option be added to specify a custom target branch? (Similar to how changeset has a baseBranch
configuration option for comparisons)
As this is a quite simple change, I'd be uo tp opening a PR with such changes, maybe with a new INPUT_TARGET_BRANCH
env variable?
When install it globaly, not found @changesets/cli
$ yarn global add [email protected] @changesets/[email protected]
$ changesets-gitlab
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name ******
[command]/usr/bin/git config user.email "******"
setting GitLab credentials
[command]/usr/bin/git checkout changeset-release/master
error: pathspec 'changeset-release/master' did not match any file(s) known to git
[command]/usr/bin/git checkout -b changeset-release/master
Switched to a new branch 'changeset-release/master'
[command]/usr/bin/git fetch origin master
From ******
* branch master -> FETCH_HEAD
[command]/usr/bin/git reset --hard origin/master
HEAD is now at f07e379 Merge branch 'testComment' into 'master'
Error: Have you forgotten to install `@changesets/cli` in "******"?
All tags are created, all packages are released and listed in the package registry.
But it fails the job and exits with code 1.
It always fails when releasing 8 or more packages.
Works well with just a few.
I'm in a monorepo using turbo repo
.
GitbeakerRequestError: Service Unavailable
at throwFailedRequestError (file:///builds/[path_to_project_build]/[project-name]/node_modules/@gitbeaker/rest/dist/index.mjs:41:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async defaultRequestHandler (file:///builds/[path_to_project_build]/[project-name]/node_modules/@gitbeaker/rest/dist/index.mjs:77:7)
at async file:///builds/[path_to_project_build]/[project-name]/node_modules/@gitbeaker/core/dist/index.mjs:138:22
at async createRelease (file:///builds/[path_to_project_build]/[project-name]/node_modules/changesets-gitlab/lib/run.js:21:9)
at async Promise.all (index 6)
at async runPublish (file:///builds/[path_to_project_build]/[project-name]/node_modules/changesets-gitlab/lib/run.js:79:13)
at async main (file:///builds/[path_to_project_build]/[project-name]/node_modules/changesets-gitlab/lib/main.js:51:28)
at async Command.parseAsync (/builds/[path_to_project_build]/[project-name]/node_modules/changesets-gitlab/node_modules/commander/lib/command.js:936:5) {
cause: {
description: '{"message":"Upstream Gitaly has been exhausted: maximum queue size reached. Try again later"}',
request: Request {
method: 'POST',
url: 'https://gitlab.com/api/v4/projects/[project_id]/releases',
headers: Headers {
'content-type': 'application/json',
'private-token': '[MASKED]'
},
destination: '',
referrer: 'about:client',
referrerPolicy: '',
mode: 'cors',
credentials: 'same-origin',
cache: 'default',
redirect: 'follow',
integrity: '',
keepalive: false,
isReloadNavigation: false,
isHistoryNavigation: false,
signal: AbortSignal { aborted: false }
},
response: Response {
status: 503,
statusText: 'Service Unavailable',
headers: Headers {
// removed due to privacy
},
body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true },
bodyUsed: true,
ok: false,
redirected: false,
type: 'basic',
url: 'https://gitlab.com/api/v4/projects/[project_id]/releases'
}
}
}
error Command failed with exit code 1.
In my previous issue I suggested changing the documentation to reflect the environment variables, but after some testing it seems that the environment variables are not set. Moreover, setting the environment variables is not possible from a child process (nodeJS) as far as I am aware.
For that problem specifically, I would suggest moving to files; e.g. changesets-gitlab-output.json
{
"published": true,
"publishedPackages": [
{ "name": "@xx/xx", "version": "1.2.0" },
{ "name": "@xx/xy", "version": "0.8.9" }
]
}
Then, a suggestion could be added to add the file to .gitignore
.
More generally, @actions
packages should not be used at all in this repo since it is only meant for Github actions.
If you are fine with such changes I can look into making a PR.
According to the NodeJS module resolution standard, you have to add packages that you require in your modules to the package dependencies. Otherwise, you rely on the hoisting of modules in the node_modules
.
In my case yarn v3 errors that @changesets/errors
, @changesets/pre
, and @changesets/read
do not exist. Yarn pnp strictly requires this standard module resolution rule.
since we updated changesets-gitlab we have now the issue that with every commit the changesets-gitlab comment command creates a new comment in our merge request. before the update it only created one comment for a merge request.
Currently, environment variables are used in several places in the project to determine the behavior.
However, it might be unclear for developers who are new to this codebase whether an environment variable is defined or not.
It should be helpful to have an exported env
variable with the "actual" types for the variables or even with pre-validation.
We could either use:
zod
to validate the environment variables and export the object.
Hi! When trying to migrate from "changesets-gitlab": "^0.10.3"
to latest version, I get an error:
$ ./builds/node_modules/.bin/changesets-gitlab
file:///builds/node_modules/@gitbeaker/rest/dist/index.mjs:2
import { createRequesterFn, presetResourceArguments, getMatchingRateLimiter, GitbeakerTimeoutError, GitbeakerRetryError, GitbeakerRequestError } from '@gitbeaker/requester-utils';
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module '@gitbeaker/requester-utils' does not provide an export named 'GitbeakerRequestError'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)
at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
at async loadESM (node:internal/process/esm_loader:[40](https://gitlab.com/noname/repo/frontend-libs/-/jobs/6580017729#L40):7)
at async handleMainPromise (node:internal/modules/run_main:66:12)
Node.js v20.5.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.19
Is there a problem with dependencies?
The built-in GitLab ${CI_JOB_TOKEN}
variable does not have appropriate access to the APIs required by this tool. https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html
Users of this package should be instructed to use a group/project access token or a personal access token instead.
It would be nice to check if comment had already been sent before sending the same one.
Thanks for your work though.
The upgrade from 0.11.0 to 0.11.1 broke some environment variable usage.
For example, previously the host would fallback to process.env.CI_SERVER_URL
, but with this latest update I receive 401 unauthorized because I rely on the built-in gitlab CI CI_SERVER_URL
environment variable instead of the explicit GITLAB_HOST
environment variable this CLI is looking for.
For more information on CI_SERVER_URL
see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
Hi! In the process of configuring CI/CD, I encountered exceptions. All network errors are not very informative:
🦋 Creating git tag...
🦋 New tag: @***/***@0.0.5
[command]/usr/bin/git push origin --tags
To https://gitlab.com/***/***/***.git
* [new tag] @***/***@0.0.5 -> @***/***@0.0.5
HTTPError: Response code 403 (Forbidden)
at Request.<anonymous> (/builds/***/***/***/node_modules/got/dist/source/as-promise/index.js:118:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
timings: {
start: 169332[73](https://gitlab.com/***/***/***/-/jobs/0000000000#L73)1[77](https://gitlab.com/***/***/***/-/jobs/0000000000#L77)94,
socket: 1693327317796,
lookup: 1693327317799,
connect: 169332731[78](https://gitlab.com/***/***/***/-/jobs/0000000000#L78)02,
secureConnect: 1693327317810,
upload: 1693327317811,
response: 169332731[80](https://gitlab.com/***/***/***/-/jobs/0000000000#L80)64,
end: 1693327318067,
error: undefined,
abort: undefined,
phases: {
wait: 2,
dns: 3,
tcp: 3,
tls: 8,
request: 1,
firstByte: 253,
download: 3,
total: 273
}
},
description: '403 Forbidden'
}
error Command failed with exit code 1.
It is unclear which part of the process the problem occurred with. It would be cool to see the details about the error 👉👈
I have set up release job but without publishing step. Didn't add INPUT_PUBLISH var. Despite successful build the job doesn't create merge request.
Configuration looks like this:
stages:
- Publish
publish:
rules:
- if: $CI_COMMIT_BRANCH == "release"
stage: Publish
when: manual
script:
- echo "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> ~/.npmrc
- yarn run changeset
variables:
INPUT_VERSION: yarn run version
INPUT_COMMIT: "Version Packages"
INPUT_TITLE: "Version Packages"
GITLAB_HOST: $CI_REPOSITORY_URL
GITLAB_TOKEN_TYPE: "job"
GITLAB_TOKEN: $CI_JOB_TOKEN
TARGET_BRANCH: "development"
CREATE_GITLAB_RELEASES: "false"
GITLAB_CI_USER_EMAIL: $GITLAB_USER_EMAIL
needs:
- job: install
artifacts: true
- job: build
artifacts: true
package.json scripts:
{
"scripts": {
"build": "rollup -c",
"prerelease": "yarn build",
"release": "changesets-gitlab publish",
"changeset": "changesets-gitlab",
"version": "changesets-gitlab version",
}
}
Running npx changesets-gitlab
I'm having this error, and I couldn't find any info about what could be the reason.
URL https://gitlab.company.com/project/path/name.git is correct and I could access by the browser.
Could you help us with any clue to look for a solution?
$ npx changesets-gitlab
::set-output name=published::false
::set-output name=publishedPackages::[]
setting git user
[command]/usr/bin/git config user.name Bot
[command]/usr/bin/git config user.email [email protected]
setting GitLab credentials
[command]/usr/bin/git checkout changeset-release/main
error: pathspec 'changeset-release/main' did not match any file(s) known to git
[command]/usr/bin/git checkout -b changeset-release/main
Switched to a new branch 'changeset-release/main'
[command]/usr/bin/git fetch origin main
fatal: unable to access 'https://gitlab.company.com/project/path/name.git/': URL using bad/illegal format or missing URL
Error: The process '/usr/bin/git' failed with exit code 128
at ExecState._setResult (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:592:25)
at ExecState.CheckComplete (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:575:18)
at ChildProcess.<anonymous> (/builds/project/path/name/node_modules/@actions/exec/lib/toolrunner.js:469:27)
at ChildProcess.emit (node:events:514:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5)
[command]/usr/bin/git fetch origin main
fatal: unable to access 'https://gitlab.company.com/project/path/name.git/': URL using bad/illegal format or missing URL
Error: The process '/usr/bin/git' failed with exit code 128
I have a weird issue, where when running changeset-gitlab
there are two pipelines created without jobs which fail immediately. It happens when using for GITLAB_TOKEN
:
But not if I use a personal access token of my regular account. For the projekt access token the api
scope is used. For the newly created account all roles etc. are set like my regular account. It‘s really weird and I don‘t know why this happens.
workaround for npm/cli#7043
Such as github changesets actions https://github.com/changesets/action , It has a parameter like createGithubReleases - A boolean value to indicate whether to create Github releases after publish or not. Default to true
Thanks!
when setting INPUT_ variables, the documentation states those variables are case insensitive. Turns out, they aren't INPUT_title
is not working, only INPUT_TITLE
is. Same for all other INPUT_ variables.
I use a maintainer personal access token with full API and Repository access.
After running the commit command I get:
HTTPError: Response code 403 (Forbidden)
at Request.<anonymous> (./node_modules/got/dist/source/as-promise/index.js:117:42)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',
description: '403 Forbidden'
}
Changesets have a pre-release feature
https://github.com/changesets/changesets/blob/main/docs/prereleases.md
Would it be possible to add this?
At the moment having to do it manually can be hard to get it right, maybe have a pre-release command?
Happy to work on this
Using the current options lib users can only provide personal access token. I want to use the Gitlab's CI_JOB_TOKEN in my comment stage as it is much safer.
According to gitbeaker docs the job token should be provided in another config.
Can we add an option to provide a job token? Are you open to a PR on this?
Instead of creating a note, it could be nice to create a discussion (thread) that can be resolved. You can prevent the merge request to be merged when you have a discussion but a note will not prevent this.
See https://docs.gitlab.com/ee/user/discussions/
On gitbeaker, the API is available in MergeRequestDiscussions
In my Gitlab workflow the comment
stage job runs the following script
pnpm changesets-gitlab comment
(node:49) DeprecationWarning: This endpoint was deprecated in Gitlab API 15.7 and will be removed in API v5. Please use the "allDiffs" function instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
So I got the deprecation warning from Gitlab, see above. I think Gitlab 15.7 was released on December 2022.
Recently changeset
added a tag command where you can make a full release without publishing to npm (incase of using packages directly in a monorepo).
What is the easiest way to use something like this?
(and thanks for the awesome work 🚀 )
The readme currently states outputs:
Outputs
published - A boolean value to indicate whether a publishing is happened or not
publishedPackages - 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"}]
As I understand, this only makes sense in the context of github (github actions / set-output cli command).
However, internally the script also does
exportVariable('PUBLISHED', true)
exportVariable('PUBLISHED_PACKAGES', result.publishedPackages)
which is far more useful in the context of gitlab. Thus, I would suggest to update the readme to reflect this.
Which brings me to another point, the variable PUBLISHED
is used as both input and output, which is problematic.
Edit: this is of course not the case due to the INPUT_ prefix.
Here is a merge request which should clarify things #165
Hi, i guess the current example of .gitlab-ci.yml
has syntax errors
stages:
- comment
- release
before_script: yarn --frozen-lockfile
comment:
image: node:lts-alpine
stage: comment
# only: merge_requests #fixed
only:
- merge_requests
script: yarn changesets-gitlab comment
release:
image: node:lts-alpine
stage: release # added
# only: main # fixed
only:
- main
script: yarn changesets-gitlab
variables:
INPUT_PUBLISH: yarn release
Fixing this way solved syntax errors for me. I can create a PR for this if you don't mind
When installing there is a warning given by npm:
npm WARN deprecated @gitbeaker/[email protected]: Please use its successor @gitbeaker/rest
Hi,
I would like to propose a feature about comment type.
With GITLAB_COMMENT_TYPE
we can set it to discussion
or note
.
When a changeset is missing I would like to have a discussion
to block merge request without resolution of the discussion.
If one is set a simple note
is ok
I propose to add an optional configuration GITLAB_COMMENT_TYPE_IF_MISSING
to allow this behaviour.
If it is ok I will create a PR with this modification
What?
Allow specifying a set of custom labels to the version package Merge Request.
How?
Provide a comma-separated string of labels through INPUT_LABELS
environment variable. For example. ci:dependency-upgrade,ci:bot
I saw that message in a pipeline which is in fact an MR but between two branches and not a feature branch and the main branch
Would that be why the comment was not generated?
Hey, I want to write the version of the packages in my monorepo to an additional file.
I have a (pnpm) Monorepo with 3 packages and I would like to change not only the package.json with the new version but also a file for the deployment of the new version. Is there a way to run a script with the new version?
In the Readme I found
If you need to add additional logic to the version command, you can do so by using a version script.
If 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.
But i can't figure out what the "version script" is. I tried to write a "version" and a "update-versions" script in my package.json, but it seems as if it didn't run...
...
"scripts": {
"version": "changeset version && echo 'test' > test",
"update-versions": "changeset version && echo 'test' > test",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
Could anyone help me, please?
In my dreamworld, changeset-gitlab changes the versions in the packages, calls my custom script (where I can edit my file with the correct version from the package.json's) and after this, changeset-gitlab pushes all changes to the branch
Hi I'm trying to release my monorepo library using changesets-gitlab, comment stage goes well, but when it comes to release stage it results into an error.
I'm trying to debug this issue since in the .git/config I have
pushurl = git@HOST:PORT/REPO.git
where HOST is not gitlab, PORT is not 22 and REPO is ofc the repo
after pnpm changesets-gitlab command I got this:
[command]/usr/bin/git push origin HEAD:changeset-release/master --force
ssh: connect to host HOST port 22: Connection refused
fatal: Could not read from remote repository.
This happen here, run.ts:292
await gitUtils.push(versionBranch, { force: true })
This is the ci yaml
stages:
- comment
- release
before_script:
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm i --no-frozen-lockfile
comment:
image: node:lts-alpine
stage: comment
only:
- merge_requests
script: pnpm changesets-gitlab comment
variables:
GITLAB_TOKEN: '${GITLAB_TOKEN}'
release:
image: node:lts-alpine
stage: release
only:
- master
script:
- apk --no-cache add git openssh
- cat .git/config
- pnpm changesets-gitlab
variables:
INPUT_ONLY_CHANGESETS: 'true'
INPUT_REMOVE_SOURCE_BRANCH: 'true'
INPUT_CREATE_GITLAB_RELEASES: 'false'
GITLAB_TOKEN: '${GITLAB_TOKEN}'
INPUT_PUBLISH: pnpm build && pnpm run publish
First of all, thank you for your work! I used this package in self-hosted gitlab, but I found it create a branch that starts with changeset-release , such as changeset-release/master.
We are using changesets-gitlab without publishing
It would be very useful if the repository got tagged when the "Version Packages" MR is merged
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.