Patch-to-Pull-Request
Create a GitHub pull request by simply POST-ing a patch
file! This is a zero-depedency commit workflow, without needing git clone
etc.
- Create a Personal Access Token here with
workflow
andrepo
scopes.- Unfortunately, tokens cannot be scoped to individual repositories, so creating a dedicated "bot" user who has full admin access to the relevant repository might be an option.
- Create a
patch
file withdiff
:diff -u <old file> <new file> > a.patch
- POST your patch with
curl
:
printf '{"event_type":"apply_patch","client_payload":{"patch":"%b"}}' \
"$(base64 -w 0 a.patch)" | \
curl --request POST \
--url 'https://api.github.com/repos/<username>/<repository>/dispatches' \
--header 'authorization: Bearer <personal access token>\
--data @-