[site]
name = "github-issues"
patterns = [
"(?i)github\\.com/[^/]+/[^/]+/issues/\\d+",
"(?i)github\\.com/[^/]+/[^/]+/pull/\\d+",
]
[rewrite]
from = "(?i)https?://github\\.com/([^/]+)/([^/]+)/(?:issues|pull)/(\\d+)[/?#]?.*"
to = "https://api.github.com/repos/$1/$2/issues/$3"
[request]
accept = "application/vnd.github+json"
auth = "env:GITHUB_TOKEN"
headers = { "User-Agent" = "nab/0.5", "X-GitHub-Api-Version" = "2022-11-28" }
[json]
title = ".title"
state = ".state"
author = ".user.login"
body = ".body"
comments = ".comments"
created_at = ".created_at"
html_url = ".html_url"
labels = ".labels[].name"
[template]
format = """
## {title} [{state}]
by @{author} ยท {comments|number} comments
Labels: {labels}
{body}
---
[View on GitHub]({html_url})
"""
[metadata]
platform = "GitHub"
author_field = "author"
title_field = "title"
published_field = "created_at"
canonical_url_field = "html_url"
[engagement]
replies = "comments"
[[fetch_additional]]
prefix = "cmt"
rewrite_from = "(?i)https?://github\\.com/([^/]+)/([^/]+)/(?:issues|pull)/(\\d+)[/?#]?.*"
rewrite_to = "https://api.github.com/repos/$1/$2/issues/$3/comments?per_page=10"
accept = "application/vnd.github+json"
[fetch_additional.json]
c0_author = "[0].user.login"
c0_body = "[0].body"
c1_author = "[1].user.login"
c1_body = "[1].body"
c2_author = "[2].user.login"
c2_body = "[2].body"