- Auth
Simple auth using a token retrieved from the github ui.
curl -u fpinzn:token https://api.github.com/user
-
Get all PRs from a repo
https://api.github.com/repos/vlipco/waybox-api/pulls
-
Get all repos from an organization
curl -u fpinzn:token https://api.github.com/orgs/vlipco/repos
- List of open PRs title, created_at, and closed_at
... 'https://api.github.com/repos/vlipco/waybox-api/pulls?state=open' | jq '.[] | {title: .title, created_at: .created_at, closed_at: .closed_at}'
- List of repo names ordered descendetly from the most recently pushed (max 100 per page)
... 'https://api.github.com/orgs/vlipco/repos?type=all&per_page=100&sort=pushed' | jq '.[] | .name'
- List of endpoints to get all open prs of all repos
... 'https://api.github.com/orgs/vlipco/repos?type=all&per_page=100&sort=pushed' | jq '.[] | "https://api.github.com/repos/vlipco/\(.name)/pulls?state=open"'
- List of open PRs for all repos including repo, title, author, created_at, body and requested_reviewers
API_TOKEN=token; curl -u fpinzn:$API_TOKEN 'https://api.github.com/orgs/vlipco/repos?type=all&per_page=100&sort=pushed' | jq '.[] | "https://api.github.com/repos/vlipco/\(.name)/pulls?state=open"' | xargs curl -u fpinzn:$API_TOKEN | jq '.[] | {repo: .head.repo.name, title: .title, author: .user.login, created_at: .created_at, requested_reviewers: (.requested_reviewers | .[] | .login), body: .body}'
- Date of creation of all PRs
API_TOKEN=token; curl -u fpinzn:$API_TOKEN 'https://api.github.com/orgs/vlipco/repos?type=all&per_page=100&sort=pushed' | jq '.[] | "https://api.github.com/repos/vlipco/\(.name)/pulls?state=open"' | xargs curl -u fpinzn:$API_TOKEN | jq '.[] | .created_at'
- Average of days all PRs in the 100 repos with the most recent pushes have been open
API_TOKEN=token; curl -u fpinzn:$API_TOKEN 'https://api.github.com/orgs/vlipco/repos?type=all&per_page=100&sort=pushed' | jq '.[] | "https://api.github.com/repos/vlipco/\(.name)/pulls?state=open"' | xargs curl -u fpinzn:$API_TOKEN | jq '.[] | .created_at' | xargs ruby -e "require 'date'; puts ARGV.reduce(0) {|sum_of_days, date| sum_of_days + (DateTime.now.new_offset - DateTime.parse(date)).to_i }/ ARGV.count"