semantic-release / git

:twisted_rightwards_arrows: semantic-release plugin to commit release assets to the project's git repository
MIT License
290 stars 65 forks source link

I get GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team with all the permission created #286

Open juannn91 opened 2 years ago

juannn91 commented 2 years ago

I have had all working correct until 18 of Agust when I start to see the following message:

An error occurred while running semantic-release: Error: Command failed with exit code 1: git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:branch
remote: GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team

I have tried to:

No success until today.

Maybe some idea of where can I look??


my package version:

{
  "branches": [{"name": "develop", "prerelease": true}, {"name": "release", "prerelease": true}, "master" ],
  "plugins": [ 
    [
      "@semantic-release/commit-analyzer", 
      {
        "releaseRules": [
          {"type": "hotfix", "release": "patch"}
        ],
        "parserOpts": {
          "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
        }
      }
    ],
    "@semantic-release/release-notes-generator",
    "@semantic-release/npm",
    [
      "@semantic-release/exec",
      {
        "verifyReleaseCmd": "echo ${nextRelease.version} > VERSION.txt"
      }
    ],
    [ "@semantic-release/changelog", {"changelogFile": "CHANGELOG.md"} ],
    [
      "@semantic-release/git",
      {
        "assets": ["package.json", "CHANGELOG.md"],
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ],
    [
      "@semantic-release/gitlab",
      {
        "gitlabUrl": "https://gitlab.com/company/group/project",
        "assets": [
          {
            "path": "CHANGELOG.md",
            "label": "changelog file"
          },
          {
            "path": "package.json",
            "label": "package file"
          }
        ]
      }
    ]
  ]
}

My CI:

stages:
  - release

release:
  image: node:lts
  stage: release
  script:
    - node --version
    - npm --version 
    - touch CHANGELOG.md
    - npm install -g semantic-release @semantic-release/exec @semantic-release/npm @semantic-release/git @semantic-release/gitlab @semantic-release/changelog
    - npx semantic-release
  artifacts:
    paths:
      - CHANGELOG.md

My logs:


Running with gitlab-runner 14.1.0-rc1 (e9489c8a)
  on docker-auto-scale 72989761
Preparing the "docker+machine" executor
00:32
Using Docker executor with image node:13.8.0 ...
Pulling docker image node:13.8.0 ...
Using docker image sha256:XYZ for node:13.8.0 with digest node@sha256:PWD ...
Preparing environment
00:03
Running on runner-72989761-project-1256548-concurrent-0 via runner-72989761-srm-1629392800-ced11904...
Getting source from Git repository
00:04
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/company/group/project/.git/
Created fresh repository.
Checking out 46d9977b as develop-test...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:46
Using docker image sha256:XYZ for node:13.8.0 with digest node@sha256:PWD ...
$ node --version
v13.8.0
$ npm --version
6.13.6
$ touch CHANGELOG.md
$ npm install -g semantic-release @semantic-release/exec @semantic-release/npm @semantic-release/git @semantic-release/gitlab @semantic-release/changelog
/usr/local/bin/semantic-release -> /usr/local/lib/node_modules/semantic-release/bin/semantic-release.js
npm WARN marked-terminal@4.1.1 requires a peer of marked@^1.0.0 || ^2.0.0 but none is installed. You must install peer dependencies yourself.
+ @semantic-release/npm@7.1.3
+ @semantic-release/exec@5.0.0
+ @semantic-release/gitlab@6.2.2
+ semantic-release@17.4.5
+ @semantic-release/git@9.0.0
+ @semantic-release/changelog@5.0.1
added 849 packages from 340 contributors in 29.33s
$ npx semantic-release
[5:08:41 PM] [semantic-release] › ℹ  Running semantic-release version 17.4.5
(node:30) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "verifyRelease" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/gitlab"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/exec"
[5:08:42 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/exec"
[5:08:50 PM] [semantic-release] › ✔  Run automated release from branch develop-test on repository https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git
[5:08:50 PM] [semantic-release] › ✔  Allowed to push to the Git repository
[5:08:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/npm"
[5:08:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/npm"
[5:08:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/exec"
[5:08:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/exec"
[5:08:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/changelog"
[5:08:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[5:08:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/git"
[5:08:50 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/git"
[5:08:50 PM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[5:08:50 PM] [semantic-release] [@semantic-release/gitlab] › ℹ  Verify GitLab authentication (https://gitlab.com/api/v4)
[5:08:51 PM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "@semantic-release/gitlab"
[5:08:51 PM] [semantic-release] › ℹ  Found git tag v1.7.0 associated with version 1.7.0 on branch develop-test
[5:08:51 PM] [semantic-release] › ℹ  Found 16 commits since last release
[5:08:51 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: TEST-00 test
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: CI-00 release docks and files
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore: FEL-84 add a MR template for standarization
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(release): 1.7.1-develop.3 [skip ci]
## [1.7.1-develop.3](https://gitlab.com/company/group/project/compare/v1.7.1-develop.2...v1.7.1-develop.3) (2021-08-18)
### Bug Fixes
* CI-00 fix change on package.json on CI ([3ffc311](https://gitlab.com/company/group/project/commit/3ffc311751e973ee761ff453443124a554034116))
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: CI-00 fix change on package.json on CI
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(release): 1.7.1-develop.2 [skip ci]
## [1.7.1-develop.2](https://gitlab.com/company/group/project/compare/v1.7.1-develop.1...v1.7.1-develop.2) (2021-08-18)
### Bug Fixes
* NL-1036 Different character limit between CC inputs ([4678f71](https://gitlab.com/company/group/project/commit/4678f716037dc19008990a98b857a64ab9f65867))
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: NL-1036 Different character limit between CC inputs
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore: NL-00 revert vue version node sass and cross env, fix import errors and typography story
chore: NL-00 rever vue version node sass and cross enve, fix import errors and typography story
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci: CI-00 testing ci semantic release config to change npm package
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore(release): 1.7.1-develop.1 [skip ci]
## [1.7.1-develop.1](https://gitlab.com/company/group/project/compare/v1.7.0...v1.7.1-develop.1) (2021-08-12)
### Bug Fixes
* NL-608 Fix to attachment file size ([d9f9677](https://gitlab.com/company/group/project/commit/d9f967766ec22c69f02444c9770bc0ef0c806207))
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci: CI-00 fix  hotfix to semantic release config
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore: NL-608 Remove undefined response on pre-commit
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: fix: NL-608 Fix to attachment file size
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The release type for the commit is patch
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci: CI-00 add hotfix to semantic release config [skip ci]
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci: CI-00 updating semantic release config [skip ci]
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: chore: NL-00 upgrade npm version to 1.7.0
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
[5:08:51 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analysis of 16 commits complete: patch release
[5:08:51 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[5:08:51 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ✔  Completed step "analyzeCommits" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ℹ  The next release version is 1.7.1-develop-test.1
[5:08:51 PM] [semantic-release] › ℹ  Start step "verifyRelease" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] [@semantic-release/exec] › ℹ  Call script echo 1.7.1-develop-test.1 > VERSION.txt
[5:08:51 PM] [semantic-release] › ✔  Completed step "verifyRelease" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:08:51 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:08:51 PM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/npm"
[5:08:51 PM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 1.7.1-develop-test.1 to package.json in /builds/company/group/project
v1.7.1-develop-test.1
[5:08:51 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/npm"
[5:08:51 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/exec"
[5:08:51 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/changelog"
[5:08:51 PM] [semantic-release] [@semantic-release/changelog] › ℹ  Update /builds/company/group/project/CHANGELOG.md
[5:08:51 PM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/changelog"
[5:08:51 PM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/git"
[5:08:51 PM] [semantic-release] [@semantic-release/git] › ℹ  Found 2 file(s) to commit
[5:08:55 PM] [semantic-release] › ✖  Failed step "prepare" of plugin "@semantic-release/git"
[5:08:55 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test
remote: GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team
To https://gitlab.com/company/group/project.git
 ! [remote rejected] HEAD -> develop-test (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git'
    at makeError (/usr/local/lib/node_modules/@semantic-release/git/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/usr/local/lib/node_modules/@semantic-release/git/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async push (/usr/local/lib/node_modules/@semantic-release/git/lib/git.js:51:3)
    at async module.exports (/usr/local/lib/node_modules/@semantic-release/git/lib/prepare.js:69:5)
    at async prepare (/usr/local/lib/node_modules/@semantic-release/git/index.js:28:3)
    at async validator (/usr/local/lib/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:31:3
    at async Object.pluginsConf.<computed> [as prepare] (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:80:11) {
  shortMessage: 'Command failed with exit code 1: git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test',
  command: 'git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: "remote: GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team\n" +
    'To https://gitlab.com/company/group/project.git\n' +
    ' ! [remote rejected] HEAD -> develop-test (pre-receive hook declined)\n' +
    "error: failed to push some refs to 'https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git'",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@semantic-release/git'
}
Error: Command failed with exit code 1: git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test
remote: GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team
To https://gitlab.com/company/group/project.git
 ! [remote rejected] HEAD -> develop-test (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git'
    at makeError (/usr/local/lib/node_modules/@semantic-release/git/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/usr/local/lib/node_modules/@semantic-release/git/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async push (/usr/local/lib/node_modules/@semantic-release/git/lib/git.js:51:3)
    at async module.exports (/usr/local/lib/node_modules/@semantic-release/git/lib/prepare.js:69:5)
    at async prepare (/usr/local/lib/node_modules/@semantic-release/git/index.js:28:3)
    at async validator (/usr/local/lib/node_modules/semantic-release/lib/plugins/normalize.js:34:24)
    at async /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
    at async /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:31:3
    at async Object.pluginsConf.<computed> [as prepare] (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:80:11) {
  shortMessage: 'Command failed with exit code 1: git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test',
  command: 'git push --tags https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git HEAD:develop-test',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: "remote: GitLab: Author 'semantic-release-bot@martynus.net' is not a member of team\n" +
    'To https://gitlab.com/company/group/project.git\n' +
    ' ! [remote rejected] HEAD -> develop-test (pre-receive hook declined)\n' +
    "error: failed to push some refs to 'https://gitlab-ci-token:[secure]@gitlab.com/company/group/project.git'",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@semantic-release/git'
}
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
release
Duration: 1 minute 28 seconds
Timeout: 1h (from project)

Runner: #44949 (12341234) shared-runners-manager-4.gitlab.com
Commit 46d9977b 
fix: TEST-00 test

 Pipeline #a123441234 for branch
release

Thanks!!

b-kamphorst commented 1 year ago

Hi all,

I spend most of my last two days looking into this issue and I found a (temporary) solution for this. The issue that you describe is caused by the commit author email (semantic-release-bot@martynus.net by default). Depending on the settings, GitLab may refuse commits whose author email does not correspond to a project member (the GitLab bot does NOT have email semantic-release-bot@martynus.net). If this setting is enabled I experience the same behaviour as you.

The setting can be disabled in "Repository Settings" -> "Push rules" -> "Select push rules" -> uncheck "Check whether the commit author is a GitLab user". If I do that, everything works like a charm!

To improve this workflow I'd like to set GIT_COMMITTER_EMAIL to the email of my bot. It appears that the bots have a default email address (link), but in our self-hosted GitLab instance the bots do not seem to have an email address so I'll have to dive deeper.

Please let me know if this solves your issue, or perhaps whether you found another solution. Thoughts that relate to my 'next step' are also welcome.

b-kamphorst commented 1 year ago

It appears that our bots DO have emails, but the API call was limited. The following yields an email address: curl -s --request GET --header "PRIVATE-TOKEN:<GL_TOKEN>" "${CI_API_V4_URL}/user" | jq '.email'

So perhaps if the container has jq and curl installed one can start the script with GIT_COMMITTER_EMAIL=$(curl -s --request GET --header "PRIVATE-TOKEN:$GL_TOKEN" "${CI_API_V4_URL}/user" | jq '.email') and everything would work without changing the settings. I'll get back to this in a few weeks.

Update 22-9-2922: remove concrete API URL and use far better suggestion by @mato-a below.

b-kamphorst commented 1 year ago

Yep, adding the following snippet to the script solves my problem without need for repo configuration changes:

script:
- export GIT_COMMITTER_EMAIL=$(curl -s --request GET --header "PRIVATE-TOKEN:$GL_TOKEN" "${CI_API_V4_URL}/user" | jq '.email')
- export GIT_AUTHOR_EMAIL=$GIT_COMMITTER_EMAIL
- semantic-release ...

Update 22-9-2922: remove concrete API URL and use far better suggestion by @mato-a below.

mato-a commented 1 year ago

Hello there,

I've had exactly the same error as @juannn91.

I have had all working correct until 18 of Agust ...

Error appeared some time after 18. August when I think the option Check whether the commit author is a GitLab user mentioned by @b-kamphorst was introduced with new GitLab release and set to true by default.

The setting can be disabled in "Repository Settings" -> "Push rules" -> "Select push rules" -> uncheck "Check whether the commit author is a GitLab user". If I do that, everything works like a charm!

I can confirm that the solution is either to set Check whether the commit author is a GitLab user to false or to include something like this before triggering semantic-release. I've chosen the latter as it is probably more secure.

  before_script:
    - export GIT_AUTHOR_EMAIL="$(curl -s -X GET -H "PRIVATE-TOKEN:$GITLAB_TOKEN" "${CI_API_V4_URL}/user" | jq -r '.email')"
    - export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
  script:
    - npm run release

Thank you both! 🚀👍

alexcochran commented 6 months ago

Hello there,

I've had exactly the same error as @juannn91.

I have had all working correct until 18 of Agust ...

Error appeared some time after 18. August when I think the option Check whether the commit author is a GitLab user mentioned by @b-kamphorst was introduced with new GitLab release and set to true by default.

The setting can be disabled in "Repository Settings" -> "Push rules" -> "Select push rules" -> uncheck "Check whether the commit author is a GitLab user". If I do that, everything works like a charm!

I can confirm that the solution is either to set Check whether the commit author is a GitLab user to false or to include something like this before triggering semantic-release. I've chosen the latter as it is probably more secure.

  before_script:
    - export GIT_AUTHOR_EMAIL="$(curl -s -X GET -H "PRIVATE-TOKEN:$GITLAB_TOKEN" "${CI_API_V4_URL}/user" | jq -r '.email')"
    - export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
  script:
    - npm run release

Thank you both! 🚀👍

Works great for me. Thanks, @mato-a !