Find out if commit comments are locked before sending POST comment request

Is there a way to find out whether a commit’s comments are locked using the API? I can’t find any documentation on this.

I’m working on a project which requires commenting on public commits. I can check the commit is public by sending a GET request but from there I can’t see how to check if it’s possible to comment or not (if comments are locked).

I can send a POST request and get an error back if the commit comments are locked, but it would be useful to know if it’s locked before sending the POST request.