diff --git a/backends/github/labels/README.md b/backends/github/labels/README.md index 17cdc10..d299dee 100644 --- a/backends/github/labels/README.md +++ b/backends/github/labels/README.md @@ -3,10 +3,10 @@ | ✅ Auth | ✅ Writes | ❌ Uploads | |---------|-----------|-----------| -**URL format** Either `https://github.com/{owner}/{repo}/labels` or any URL that starts with `https://api.github.com/repos/` and ends with `/labels` -* Labels for a repository: `/repos/{owner}/{repo}/labels` -* Labels for an issue: `/repos/{owner}/{repo}/issues/{issue_number}/labels` -* Labels for issues in a milestone: `/repos/{owner}/{repo}/milestones/{milestone_number}/labels` +**URL format** +* Labels for a repository: `https://github.com/{owner}/{repo}/labels` or `https://api.github.com/repos/{owner}/{repo}/labels` +* Labels for an issue: `https://github.com/{owner}/{repo}/issues/{issue_number}/labels` or `https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}/labels` +* Labels for issues in a milestone: `https://github.com/{owner}/{repo}/milestones/{milestone_number}/labels` or `https://api.github.com/repos/{owner}/{repo}/milestones/{milestone_number}/labels` Builds on the [Github API](../api/) backend, so it also automatically deals with pagination, just add `max_pages=N` to your URL (where `N` is the number of pages you want to fetch as a maximum). Note this can incur up to `N` HTTP requests, depending on the size of the data. diff --git a/backends/github/labels/github-labels.js b/backends/github/labels/github-labels.js index 0449a51..3bcc5fa 100644 --- a/backends/github/labels/github-labels.js +++ b/backends/github/labels/github-labels.js @@ -6,10 +6,9 @@ import GithubAPI from "../api/github-api.js"; */ export default class GithubLabels extends GithubAPI { static urls = [ - {hostname: "api.github.com", pathname: "/repos/:owner/:repo/labels"}, - {hostname: "api.github.com", pathname: "/repos/:owner/:repo/issues/:issue_number/labels"}, - {hostname: "api.github.com", pathname: "/repos/:owner/:repo/milestones/:milestone_number/labels"}, - {hostname: "github.com", pathname: "/:owner/:repo/labels"}, + {hostname: "(api.)?github.com", pathname: "(/repos)?/:owner/:repo/labels"}, + {hostname: "(api.)?github.com", pathname: "(/repos)?/:owner/:repo/issues/:issue_number(.+)?/labels"}, + {hostname: "(api.)?github.com", pathname: "(/repos)?/:owner/:repo/milestones/:milestone_number(.+)?/labels"}, ]; static phrases = {