The repository contains a basic Github client for its REST API.
- Ruby 3.1
- Access to at least one Github repository
- Please create a personal access token for your personal account so that the Github API requests work. The repository is public, so any token will work.
It needs to be run at the command line like this
TOKEN=github_pat_xxx ruby process.rb <repository URL, like https://api.github.com/repos/user_or_organization/repo>
The code implements only one method in the API - issues. It outputs up to 50 issues in the provided repository. It lets you set whether the
issues returned are open or closed, and then displays them in decreasing order of date as follows:
- If you selected open issues, the date used is the issue's created date.
- Else, it's the issues' closed date.
- Part 1 (REST): Added reusable pagination, filtered PRs, sorted by date. Verified closed issues = 739 for
paper_trail(link). - Tests: Pagination, sorting, PR filtering, and GraphQL mapping/sorting all pass.
- Bonus 2 (GraphQL): Implemented client + processor (Issues/DraftIssues, Sprint Date, Points). Live run requires a PAT with Projects: Read-only.
# Closed issues = 739
export TOKEN='your_pat'
TOKEN="$TOKEN" ruby process.rb https://api.github.com/repos/paper-trail-gem/paper_trail | wc -l
# Run tests
ruby -Itest test/client_pagination_test.rb
ruby -Itest test/processor_issues_test.rb
ruby -Itest test/project_processor_test.rb
# Bonus 2 (requires Projects: Read-only on target org)
curl -s -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"query":"query($o:String!,$n:Int!){ organization(login:$o){ projectV2(number:$n){ title } } }","variables":{"o":"interview-container","n":1}}' https://api.github.com/graphql
TOKEN="$TOKEN" ruby project_process.rb interview-container 1 | head -n 10