2

I'm using semantic-release in a GitLab CI pipeline. The release fails at the @semantic-release/git plugin step due to this error:

remote: ERROR: New commit has non-whitelisted author email: [[email protected]](mailto:[email protected])
remote: Only emails ending with: @companydomain.com

I've set the author and committer info in all relevant places:

  • .releaserc.json:

    [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/gitlab",
        { "gitlabUrl": "https://gitlab.example.com" }
      ],
      "@semantic-release/npm",
      [
        "@semantic-release/git",
        {
          "gitAuthor": "bot-name <[email protected]>",
          "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
          "assets": ["package.json", "CHANGELOG.md"]
        }
      ]
    ]
    
  • .gitlab-ci.yml:

    before_script:
      - git config --global user.name "bot-name"
      - git config --global user.email "[email protected]"
    
    variables:
      GIT_AUTHOR_NAME: 'bot-name'
      GIT_AUTHOR_EMAIL: '[email protected]'
      GIT_COMMITTER_NAME: 'bot-name'
      GIT_COMMITTER_EMAIL: '[email protected]'
    
  • Dockerfile:

    ENV GIT_AUTHOR_NAME="bot-name"
    ENV GIT_AUTHOR_EMAIL="[email protected]"
    ENV GIT_COMMITTER_NAME="bot-name"
    ENV GIT_COMMITTER_EMAIL="[email protected]"
    
    RUN git config --global user.name "$GIT_AUTHOR_NAME" \
      && git config --global user.email "$GIT_AUTHOR_EMAIL"
    

Despite setting these values, the release commit still uses the default [email protected], and GitLab rejects the push due to email policy.

How can I ensure semantic-release uses the correct author email when committing in GitLab CI?

1
  • Hi, I have the same problem, were you able to solve it? Thanks Commented Sep 2 at 0:49

2 Answers 2

0
  1. Set a verified email in the semantic-release configuration:

You need to explicitly set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and GIT_COMMITTER_EMAIL environment variables to a GitLab-verified user email (e.g., the CI user or bot user with push access).

In .gitlab-ci.yml, set these before the semantic-release step:

variables:
  GIT_AUTHOR_NAME: "Your Bot Name"
  GIT_AUTHOR_EMAIL: "[email protected]"
  GIT_COMMITTER_EMAIL: "[email protected]"


Alternative Fix:
If you use a bot account:

Create a dedicated GitLab user (e.g., [email protected])

Verify the email.

Generate a Personal Access Token with api and write_repository scopes.

Use it in your pipeline.
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I set GIT_AUTHOR_* and git config in CI, but semantic-release still commits with [email protected]. Still trying to find a reliable way to override the commit author in GitLab CI.
okay thankyou for your Attenction , I will worked on it
0

I fixed the problem in the GitLab CI/CD by setting the variable GIT_COMMIT_AUTHOR with the value name <[email protected]>.

You can find that reference in:

https://github.com/python-semantic-release/python-semantic-release/blob/master/src/semantic_release/cli/config.py#L354

https://github.com/python-semantic-release/python-semantic-release/blob/master/src/semantic_release/const.py#L23

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.