git-cliff icon indicating copy to clipboard operation
git-cliff copied to clipboard

Support overriding the Commit and Pull request API URL in config

Open Weugene opened this issue 7 months ago • 3 comments

Is there an existing issue or pull request for this?

  • [x] I have searched the existing issues and pull requests

Feature description

It is not possible to override default URLs for commit and pull requests. Some companies use different links for commit and pull requests. This can be doable via config or env variable: BITBUCKET_COMMIT_API_URL BITBUCKET_PULL_REQUEST_API_URL

It can be extended not only for Bitbucket but also for other repos systems github/gitlab/etc.

UPD:

I use: api_url = "https://<my_company>/rest/api/1.0/projects" It receives commits SUCCESSFULLY: https://<my_company>/rest/api/1.0/projects/<project>/repos/<repo_name>/commits Returns JSON with commits.

But fails to receive pull requests ERROR 404: https://<my_company>/rest/api/1.0/projects/<project>/repos/<repo_name>/pullrequests It returns:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status><status-code>404</status-code>
<message>HTTP 404 Not Found</message>
</status>

But this with hyphen in name: (Not pullrequests, but pull-requests) https://<my_company>/rest/api/1.0/projects/<project>/repos/<repo_name>/pull-requests Returns correct JSON So, I have no possibility to change the link to the pull request API.

Desired solution

[remote.bitbucket] api_url="..." owner = ".." repo = "..." commit_api_url="..." pull_request_api_url="..."

the same for github, gitlab, etc

Alternatives considered

None.

Additional context

No response

Weugene avatar Jun 03 '25 13:06 Weugene

The API url can already be overridden via api_url but I'm not sure what you mean by "different links for commit and pull requests". Can you give me a more concrete example with links?

orhun avatar Jun 03 '25 13:06 orhun

Dear @orhun, I have clarified in the description

Weugene avatar Jun 12 '25 13:06 Weugene

Hello again @Weugene, sorry for the late reply.

I've looked at the problem description and I'm still struggling to follow. I think you would like to define your own custom remote instead of overriding the API URL of the already supported ones. A new config option to change the API URL of remotes (e.g. Bitbucket, GitHub) does not make sense to me because they are not supposed to change. We should only touch them if one day e.g. GitHub decides to release v2 of their pull requests API.

With that being said, I'm not entirely sure how your API works. What Git hosting service are you using? Why do you have a custom pull-requests API? What does it return? (e.g. is it the same structure as what git-cliff is using?)

I need more details to help out with your use case :)

orhun avatar Jun 22 '25 09:06 orhun