Skip to content

Commit

Permalink
Clarify that merged_by only works for --pull-request, refs #48
Browse files Browse the repository at this point in the history
Also fixed a bug with --issue and --pull-request introduced in fa5aa9e
  • Loading branch information
simonw committed Nov 30, 2020
1 parent cae005f commit eb29918
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ You can use the `--pull-request` option one or more times to load specific pull

$ github-to-sqlite pull-requests github.db simonw/datasette --pull-request=81

Note that the `merged_by` column on the `pull_requests` table will only be populated for pull requests that are loaded using the `--pull-request` option - the GitHub API does not return this field for pull requests that are loaded in bulk.

## Fetching issue comments for a repository

The `issue-comments` command retrieves all of the comments on all of the issues in a repository.
Expand Down
10 changes: 6 additions & 4 deletions github_to_sqlite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,11 @@ def save_license(db, license):

def fetch_issues(repo, token=None, issue_ids=None):
headers = make_headers(token)
if issue_ids is not None:
headers["accept"] = "application/vnd.github.v3+json"
if issue_ids:
for issue_id in issue_ids:
url = "https://api.github.com/repos/{}/issues/{}".format(repo, issue_id)
response = requests.get(url)
response = requests.get(url, headers=headers)
response.raise_for_status()
yield response.json()
else:
Expand All @@ -352,12 +353,13 @@ def fetch_issues(repo, token=None, issue_ids=None):

def fetch_pull_requests(repo, token=None, pull_request_ids=None):
headers = make_headers(token)
if pull_request_ids is not None:
headers["accept"] = "application/vnd.github.v3+json"
if pull_request_ids:
for pull_request_id in pull_request_ids:
url = "https://api.github.com/repos/{}/pulls/{}".format(
repo, pull_request_id
)
response = requests.get(url)
response = requests.get(url, headers=headers)
response.raise_for_status()
yield response.json()
else:
Expand Down

0 comments on commit eb29918

Please sign in to comment.