Gitlab changelogs API error: Failed to generate the changelog: denied by custom hooks

Changelogs API Error with custom hooks

I am trying to use the changelogs API in order to create and update my changelogs based on commits pushed to my main branch.

This is my pipeline

stages:
  - tag

changelog:
  stage: tag
  image: curlimages/curl:7.79.1
  only:
    - main
  script:
    - '. gitlab-changelog.sh ${API_TOKEN} https://gitlab.com/api/v4/projects/${ID}/repository/changelog'

And this is my script:

#!/bin/bash

app_version=$(cat VERSION.md)

branch=main

echo "CHANGELOGS SCRIPT IS RUNNING!"

link=https://gitlab.com/<path-to-project>/-/blob/${branch}/CHANGELOG.md

GITLAB_PROJECT_ACCESS_TOKEN=$1

GITLAB_PROJECT_CHANGELOG_API=$2

response=$(curl --write-out '%{http_code}' --request POST --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_ACCESS_TOKEN}" --data "version=${app_version}&branch=${branch}&from=${START_COMMIT_SHA}" "${GITLAB_PROJECT_CHANGELOG_API}")

echo "response: $response"

if [ $response == 200 ]

then echo "Updated changelog: ${link}"

else echo "An error occurred when requesting GitLab API"

fi;

My idea is that whenever I push to main a commit with this format:

#issue_number Title

Body

Changelog: feature

I would get my CHANGELOG.md file updated by the API but right now I am getting the following error:

Failed to generate the changelog: denied by custom hooks

My project has a commit filter that only accepts messages that starts with #issue_number, perhaps is related to this.

Any idea or solution would be appreciated. :ok_hand: