This repository has been archived by the owner on Nov 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from openpharma/add/labels
Merge in issue labels function
- Loading branch information
Showing
6 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: R Package Validation report | ||
|
||
on: # Run this action when a release is published | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
r-pkg-validation: | ||
name: Create report 📃 | ||
runs-on: ubuntu-latest | ||
# Set Github token permissions | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
packages: write | ||
deployments: write | ||
steps: | ||
- name: Checkout repo 🛎 | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build report 🏗 | ||
uses: insightsengineering/thevalidatoR@main | ||
# see parameters above for custom templates and other formats | ||
|
||
# Upload the validation report to the release | ||
- name: Upload report to release 🔼 | ||
if: success() | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
file: ./validation_report.pdf | ||
asset_name: validation-report.pdf | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref }} | ||
overwrite: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
README-roche.Rmd | ||
docs | ||
README.html | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#' Get issues for a repo | ||
#' | ||
#' @param full_names Vector of repo names (format 'org/repo') | ||
#' @param days_back How many days back to look for commits. | ||
#' @param state Defaults to open. Search issues based on open, closed or all. | ||
#' @param ... Pass down options to \code{gh::gh()} | ||
#' | ||
#' @importFrom magrittr "%>%" | ||
#' | ||
#' @export | ||
#' | ||
#' @details | ||
#' | ||
#' \strong{New Columns} | ||
#' | ||
#' \describe{ | ||
#' | ||
#' \item{url}{URL for the issue} | ||
#' \item{label_name}{Name of the label} | ||
#' \item{label_color}{Hex colour} | ||
#' \item{label_description}{Label description} | ||
#' } | ||
#' | ||
gh_issues_labels_get <- function( | ||
full_names, | ||
days_back = 30, | ||
state = c("open","closed","all"), | ||
... | ||
) { | ||
since <- Sys.Date() - days_back | ||
|
||
# Loop through full names | ||
labels <- NULL | ||
for (i_repo in full_names) { | ||
i_issues <- gh::gh("GET /repos/:full_name/issues?state=:state", | ||
full_name = i_repo, | ||
since = since, | ||
.limit = Inf, | ||
state = state , | ||
.progress = FALSE, | ||
... | ||
) | ||
urls <- i_issues %>% | ||
purrr::map_chr(c("html_url"), .null = NA_character_) | ||
# Loop through issues in a repo | ||
for (i_issue_n in seq_along(i_issues)) { | ||
i_issue <- i_issues[[i_issue_n]] # not this! | ||
|
||
i_labels <- tibble::tibble( | ||
url = urls[i_issue_n], | ||
label_name = i_issue$labels %>% | ||
purrr::map_chr(c("name"), .null = NA_character_), | ||
label_color = i_issue$labels %>% | ||
purrr::map_chr(c("color"), .null = NA_character_), | ||
label_description = i_issue$labels %>% | ||
purrr::map_chr(c("description"), .null = NA_character_) | ||
) | ||
|
||
labels <- dplyr::bind_rows( | ||
i_labels, labels | ||
) | ||
} | ||
} | ||
labels | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.