We need to implement a python script to read the git commit message when the user commits with the following syntax (e.g: ABC-123: + commit message) ABC-123 is the Jira issue Id. And also we need to check Jira issue id is valid in Jira server. Could you please help on how to implement this requirement.
You could use something like GitPython (https://gitpython.readthedocs.io/en/stable/intro.html) to extract the commit message and then parse it using RegEx.
You can't. You might be able to integrate with the GitHub API to automatically reject checks on a PR that has an invalid name, but you are not able to prevent people from pushing branches with invalid ID's.