Git hooks pre-receive GITEA_PR_ID env variable value

I am trying to create a git hook checking on pull request before merge. I was really happy to see there is an env variable GITEA_PR_ID set by gitea. Unfortunately the value in this variable is not pull request number I was hoping for (e.g. 15 for refs/pull/15/head), but there is stored some internal DB pull request auto-increment ID which I don’t know how to use for the hook purpose.

I am curious if this is a bug and the variable is populated with wrong ID by mistake, or if I am missing something. If the later please can you help me to understand how to get pull request number as git understands it in the pre-receive hook?

This is what I’ve learnt on github

It is intentional for internal use PR index could be added as additional variable

Please note: These environment variables do not represent a public API at present and we reserve the right to change the names and what is set without reservation.

Related, I’ve opened an issue for discussion