semantic-release: Git pre-receive hook trigger when pushing Git notes

When we upgraded to v16 we started getting the following error in GitLab:

Commit message does not follow the pattern \'^(build|ci|docs|feat|fix|perf|refactor|style|test|chore)(\\([a-z]+\\)){0,1}:\

It looks like the new notes part is committing with a format that doesn’t follow the commit format, but I can’t see what the commit message is in the logs.

Have I missed a prefix or is something else wrong?

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

As a temporary workaround you may add the following sequence to your regex pattern

^(Notes added by \'git notes add\')

So it will match the refs convention

git log --notes refs/notes/semantic-release --oneline | head
0672150 Notes added by 'git notes add'
30437e0 Notes added by 'git notes add'
7aff5cf Notes added by 'git notes add'
ca9e291 Notes added by 'git notes add'
9e6e3b2 Notes added by 'git notes add'
2721fd1 Notes added by 'git notes add'
4124c96 Notes added by 'git notes add'
178e743 Notes added by 'git notes add'
6a044fb Notes added by 'git notes add'
f539237 Notes added by 'git notes add'

Looking forwards for a fix from GitLab team

I also have this issue, it would be really helpful if we could at least configure the commit message. We have a hook to check for jira tickets in the commits and it is failing too

remote: 0000000000000000000000000000000000000000 f61c810b54cb94a09ea5e778598439b6ef653205 refs/notes/semantic-release        
remote: Commit f61c810b54cb94a09ea5e778598439b6ef653205 does not contain a valid JIRA ticket: 'Notes added by 'git notes add'        
remote: 
remote: '        
remote: pre-receive hook validation FAILED   

Raised a GitLab issue, I’m going to try getting a test project setup for this as well. https://gitlab.com/gitlab-org/gitlab/issues/207807

I tried to do a bit of research but couldn’t find any information related to how Git notes should behave with commit hooks. Intuitively I would says notes should not trigger a commit hook, but I don’t know what is the intended behavior from the Git team perspective. I don’t know if it’s specific to GitLab either.

I would recommend to:

  • Test with another Git host (GitHub, Bitbucket or custom Git repo) to figure out if it’s GitLab related
  • If it’s GitLab related open an issue with them
  • If not, open an issue with the Git team and ask if it’s the intended behavior and if there is workaround