ge.github¶
GitHub data fetching via gh CLI.
Provides functions to retrieve issues, PRs, comments, timeline events, related commits, and referenced code – all through the gh CLI so that private repo access is handled by the user’s existing gh auth.
Functions
|
Find recent commits that reference this issue number. |
|
Find PRs that reference or close this issue. |
|
Fetch all comments on an issue or PR. |
|
Fetch the combined commit status (CI checks) for a git ref. |
|
Get the default branch name for a repo. |
|
Fetch a GitHub Discussion via GraphQL (discussions aren't in REST API). |
|
Fetch a file's content at a specific git ref (branch, tag, sha). |
|
Fetch a GitHub issue with body, labels, assignees, state, etc. |
|
Fetch a GitHub pull request with body, diff stats, merge state, etc. |
|
Fetch the raw diff of a PR. |
|
Fetch the list of files changed in a PR. |
|
Fetch inline review comments on a PR (code-level comments). |
|
Fetch PR reviews (approved, changes requested, etc.). |
|
Fetch the issue/PR timeline (events: referenced, closed, labeled, ...). |
Find recent commits that reference this issue number.
>>> # commits = find_related_commits('owner/repo', 42)
Find PRs that reference or close this issue.
Uses the timeline API to find cross-referenced PRs, and also searches for PRs mentioning the issue number.
>>> # prs = find_related_prs('owner/repo', 42)
- ge.github.get_comments(repo, number)[source]¶
Fetch all comments on an issue or PR.
>>> # comments = get_comments('owner/repo', 42)
- ge.github.get_commit_status(repo, ref)[source]¶
Fetch the combined commit status (CI checks) for a git ref.
>>> # status = get_commit_status('owner/repo', 'abc123')
- ge.github.get_default_branch(repo)[source]¶
Get the default branch name for a repo.
>>> # branch = get_default_branch('owner/repo')
- ge.github.get_discussion(repo, number)[source]¶
Fetch a GitHub Discussion via GraphQL (discussions aren’t in REST API).
>>> # disc = get_discussion('owner/repo', 5)
- ge.github.get_file_at_ref(repo, path, *, ref='HEAD')[source]¶
Fetch a file’s content at a specific git ref (branch, tag, sha).
>>> # content = get_file_at_ref('owner/repo', 'src/main.py', ref='main')
- ge.github.get_issue(repo, number)[source]¶
Fetch a GitHub issue with body, labels, assignees, state, etc.
>>> # issue = get_issue('owner/repo', 42)
- ge.github.get_pr(repo, number)[source]¶
Fetch a GitHub pull request with body, diff stats, merge state, etc.
>>> # pr = get_pr('owner/repo', 7)
- ge.github.get_pr_diff(repo, number)[source]¶
Fetch the raw diff of a PR.
>>> # diff = get_pr_diff('owner/repo', 7)
- ge.github.get_pr_files(repo, number)[source]¶
Fetch the list of files changed in a PR.
>>> # files = get_pr_files('owner/repo', 7)
- ge.github.get_review_comments(repo, number)[source]¶
Fetch inline review comments on a PR (code-level comments).
>>> # review_comments = get_review_comments('owner/repo', 7)