Can one us API via python-gitlab to collect GitHub Pull Request and create a GitLab Merge request from it?

I have a GitLab repo mirrored in GitHub. When we get Pull requests from GitHub we would like to set up a webhook that translates the github pr to a gitlab mr conserving the github commit sha’s so that once the Gitlab merge request is merged, the GitHub PR is automatically marked as merged via the mirroring.

I have solved this now using python and subprocess typically with this process (pseudocode):

git clone https://<repo>

#add github remote if not already done
git remote add github https://<github-repo>

#fetch the pr and apply to a new branch (branch_name)
git fetch github pull/' + str(pr_number) + '/head:' + branch_name

#push  the new branch to GitLab
git push origin ' + branch_name

#create a GitLab MR with the new branch - using python-gitlab API

While this works, I would much rather use the API via python-gitlab - the procedure for this currently implemented is:

create new branch 
create commit to branch
create merge request with branch

Hower, to create the commit one typically needs:

   commit_dict = {                                                                                                                                                                                                                      
        "branch": branch_name,                                                                                                                                                                                                           

where actions is a list dictionaries of type


I can extract all this from the github PR via API using python-gitlab, but this constructs commits with new commit sha’s - different than the ones in the GitHub PR.

So I would like either to be able to ensure that the commit sha is the same, or in some other way manage to extract the Github PR and all its contents to create a MR in GitLab that ensures that the mirroring works as intended, i.e. that once the “exported” PR is merged into GitLab the GitHub PR is aware via the mirroring and marks it as merged.

Has anyone solved this and have some tips?