Reputation: 337
I need to fetch all push events in my remote repo for my organization with curl or git api. I cannot use the web hook feature in GitHub because my webhook server is running behind a firewall.So github.com cannot call my webhook url.i need to get the webhook payload using curl
when i try:-
curl -X GET -u $GITHUB_USER:$GITHUB_PASSWORD https://api.github.com/repos/:org/:repo/events
getting all events like push and create,i only need push events
Upvotes: 3
Views: 629
Reputation: 7978
You can pipe the output of that curl command to jq
and pick out just the events with type PushEvent
, like this:
curl \
-X GET \
-u $GITHUB_USER:$GITHUB_PASSWORD \
https://api.github.com/repos/:org/:repo/events \
| jq '.[] | select(.type == "PushEvent")'
Note that the second |
pipe is inside ''
single-quotes as it part of the arguments to jq
. It is not for the shell.
Upvotes: 2