gh: Move away from using curl for patches and to GitHub API

:warning: This initially failing PR is an TODO item for `am/apply` commands. We need to switch them over to the GitHub API so that they won't have any external dependencies.

/cc @jingweno
No worry. Let me take care of that :smile_cat: