use gh to ask the API of GitHub and et a list of issues with their labels and milestones.

get_issues(selector = getOption("IssueTrackeR.selector"), verbose = TRUE, ...)

get_labels(selector = getOption("IssueTrackeR.selector"), verbose = TRUE, ...)

get_milestones(
  selector = getOption("IssueTrackeR.selector"),
  verbose = TRUE,
  ...
)

Arguments

selector

A SelectorTB object to check. See the corresponding vignettes: https://tanguybarthelemy.github.io/IssueTrackeR/articles/selectors.html to have more information about selectors. By default getOption("IssueTrackeR.selector").

verbose

Boolean indicating whether to print additional information.

...

Additional arguments to connect to the GitLab as gitlab_url and private_token. (See the documentation of get to have more information on theses parameters)

Value

The function get_issues returns an object of class IssuesTB. It is a list composed by object of class IssueTB. An object of class IssueTB represents an issue with simpler structure (with number, title, body and labels).

The function get_labels returns a list representing labels with simpler structure (with name, description, colour).

The function get_milestones returns a list representing milestones with simpler structure (with title, description and due_on).

Details

The functions of get type are useful to retrieve object related to issues from GitHub. So it's possible to retrieve issues, labels and milestones.

The defaults value for the argument dataset_name depends on the function:

  • defaults is "list_issues.yaml" for get_issues()

  • defaults is "list_milestones.yaml" for get_milestones()

  • defaults is "list_labels.yaml" for get_labels()

Examples

# \donttest{
if (check_github_connection(verbose = FALSE)) {
    # From online

    online_selector <- init_selector(
        source = "GitHub",
        owner = "TanguyBarthelemy",
        repo = "IssueTrackeR"
    )
    issues <- get_issues(selector = online_selector)
    print(issues)

    labels <- get_labels(selector = online_selector)
    print(labels)

    milestones <- get_milestones(selector = online_selector)
    print(milestones)
}
#> Repo: IssueTrackeR  owner: TanguyBarthelemy 
#> There are 16 issues. 
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#77 ──
#> 
#> Title: Concernant les labels et les comments...
#> Text:
#> Il y a des fonctions:
#> 
#> - `create_empty_comments_list`
#> - `create_empty_labels_list`
#> - `generate_empty_comments_list`
#> - ...
#> 
#> Il faudrait uniformiser les usages pour simplifier et regrouper les fonctions.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#76 ──
#> 
#> Title: Adding missing info from GitLab
#> Text:
#> There are missing info in the issues retrieved from GitLab :
#> 
#> - [ ] Comments
#> - [ ] State reason
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#74 ──
#> 
#> Title: `get_labels_github()` whould work if `repo = NULL`
#> Text:
#> As for `get_issues_github()` if `repo = NULL`, `get_labels_github()` should looks for every repo of a owner.
#> 
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#73 ──
#> 
#> Title: Ajouter exemple print labels
#> Text:
#> Ajouter un exemple de print() d'un objet labelsTB
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#71 ──
#> 
#> Title: `raw_object` have class
#> Text:
#> The object from `gh::gh` has classes `gh_response`. We should had S3-method according to this class.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#70 ──
#> 
#> Title: Ajouter un argument `negate` à `with_labels`
#> Text:
#> L'idée est d'ajouter un argument `negate` à `with_labels` qui permettrait de dire le contraire d'une proposition. 
#> 
#> Par exemple:
#> 
#> - `with_labels("bug")` désigne toutes les issues qui ont le label `"bug"`
#> - `with_labels("bug", negate = TRUE)` qui ne l'ont pas
#> - `with_labels(c("bug", "dev"))` désigne toutes les issues qu
#> ...
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#57 ──
#> 
#> Title: [goodpractice] covr
#> Text:
#> ```
#> ✖ write unit tests for all functions, and all package code in general. 62% of code lines are covered by
#>   test cases.
#> 
#>     R/check.R:222
#>     R/check.R:223
#>     R/check.R:224
#>     R/check.R:225
#>     R/check.R:226
#>     ... and 737 more lines
#> ```
#> 
#> *All the issues starting with [goodpractice] are results from the [{goodpra
#> ...
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#53 ──
#> 
#> Title: Coverage v2.1.0
#> Text:
#> To continue the coverage, we put a goal of **90%** for v2.1.0.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#52 ──
#> 
#> Title: Mutators test coverage for v2.1.0
#> Text:
#> I am setting a coverage target of **30%** for version 2.1.0, using mutators.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#50 ──
#> 
#> Title: no default for repo and owner and dir
#> Text:
#> BY default, we should set dir to `NULL` or to `""`. So when getting the issues (`get_issues`) we can switch source to "online" if dir is not defined.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#49 ──
#> 
#> Title: Extract labels and milestones from issues
#> Text:
#> The functions `get_labels` and `get_milestones` should work with `IssueTB` and `IssuesTB` objects.
#> 
#> The goal is to extract all the labels and milestones used in a list of issues or in an issue.
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#47 ──
#> 
#> Title: Bonnes pratiques de documentation
#> Text:
#> Suivre les bonnes pratiques de documentation :
#> 
#> - [ ] Boolean et non Logical
#> - [ ] Suivre le guide écrit pour le rjdverse
#> - [ ] Mettre `` `my_fun` `` plutôt que `\code{my_fun}` et uniformiser les usages
#> 
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#44 ──
#> 
#> Title: Complete `goodpractice::goodpractice()` checkup
#> Text:
#> Here is the output from {goodpractice}:
#> 
#> ```
#> > gp
#> ── It is good practice to ───────────────────────────────────────────────────────────────────────
#> 
#> ✖ keep functions short and focused. Long functions are harder to understand, test, and maintain.
#>   Consider splitting into smaller helpers. (Default limit of 50 set with o
#> ...
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#43 ──
#> 
#> Title: What to do with type?
#> Text:
#> Une question que je me pose : Si  j'ouvre une issue (mais task, bug ou autre) et que je la ferme avec différent attribut (won't do, duplicated...) qu'est ce qu'il va s'afficher dans l'appel gh::gh ?
#> Aussi est ce que je peux récupérer cette nouvelle info (type) et l'ajouter ? -> que se passe t-il pour les anciennes issu
#> ...
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#24 ──
#> 
#> Title: Continue coverage
#> Text:
#> The current coverage is 26%. We should update it a lot!
#> 
#> Some functions are not tested:
#> 
#> - [x] `[.IssuesTB`
#> - [ ] `[[<-.IssuesTB`
#> - [ ] `[<-.IssuesTB`
#> - [ ] `add_n_years`
#> - [ ] `append`
#> - [ ] `append.default`
#> - [ ] `append.IssuesTB`
#> - [ ] `author_last_comment`
#> - [ ] `author_last_comment.IssuesTB`
#> - [ ] `author_last_com
#> ...
#> 
#> 
#> ── Issue TanguyBarthelemy/IssueTrackeR#22 ──
#> 
#> Title: Change yaml to parquet
#> Text:
#> Is it possible to add this *new feature*?
#> 
#> Repo: IssueTrackeR  owner: TanguyBarthelemy 
#> Reading labels... Done!
#> 41 labels found.
#> There is 1 repo.
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, 
#> - TanguyBarthelemy/IssueTrackeR:, automated issue, communication, complexity: complex, complexity: moderate, complexity: trivial/easy, complexity: very-complex, documentation, duplicate, effort: long, effort: medium, effort: short, effort: unknown, effort: very-long, good first issue, good practice, help wanted, invalid, missing examples, priority: critical, priority: high, priority: low, priority: medium, question, report, status: can't-reproduce, status: completed, status: duplicate, status: in-progress, status: needs-information, status: on-hold, status: review-needed, status: triage, status: won't-do/fix, tests, type: bug, type: enhancement, type: feature, type: maintenance, type: question, typo, wontfix
#> Repo: IssueTrackeR  owner: TanguyBarthelemy 
#> Reading milestones... 
#> 	-  v2.1.0 ... Done!
#> Done! 1 milestones found.
#>   source  title description     due_on closed_at          creator state
#> 1 GitHub v2.1.0             2027-02-28      <NA> TanguyBarthelemy  open
#>   nb_issues_open nb_issues_closed         repo            owner
#> 1             10                0 IssueTrackeR TanguyBarthelemy
#>                                                            url
#> 1 https://github.com/TanguyBarthelemy/IssueTrackeR/milestone/7
# }

# From local

local_selector <- init_selector(
    source = "Local",
    dataset_dir = system.file("data_issues", package = "IssueTrackeR"),
    dataset_name = NULL
)

issues <- get_issues(selector = local_selector)
#> The issues will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_issues.yaml.
labels <- get_labels(selector = local_selector)
#> The labels will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_labels.yaml.
milestones <- get_milestones(selector = local_selector)
#> The milestones will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_milestones.yaml.