Skip to content

Instantly share code, notes, and snippets.

@maelle
Created April 16, 2018 08:55
Show Gist options
  • Save maelle/2bc6881f96f12707db0fa0a555f41ea4 to your computer and use it in GitHub Desktop.
Save maelle/2bc6881f96f12707db0fa0a555f41ea4 to your computer and use it in GitHub Desktop.
Create labels for the unconf18 repo issue tracker
# not possible to change labels via V4
# https://platform.github.community/t/mutations-for-label/2144
# list labels
current_labels <- gh::gh("/repos/:owner/:repo/labels",
owner = "ropensci",
repo = "unconf18")
current_labels <- purrr::map_chr(current_labels, "name")
# delete all labels
delete_label <- function(name){
gh::gh("DELETE /repos/:owner/:repo/labels/:name",
owner = "ropensci",
repo = "unconf18",
name = name)
}
purrr::walk(current_labels, delete_label)
# last year labels
unconf_labels <- gh::gh("/repos/:owner/:repo/labels",
owner = "ropensci",
repo = "unconf17")
unconf_labels <- purrr::map_chr(unconf_labels, "name")
# by hand add emojis for easier browsing
# dput(unconf_labels)
# https://www.webpagefx.com/tools/emoji-cheat-sheet/
# koalas need user-friendly tools
unconf_labels <- c("communication :loudspeaker:",
"data processing :nut_and_bolt:",
"discoverability :mag:",
"documentation :page_facing_up:",
"ease-of-use :koala:",
"geospatial :globe_with_meridians:",
"graphics :bar_chart:",
"metadata :bookmark:",
"open data :gift:",
"package development support :package:",
"publication :postal_horn:",
"reproducibility :monkey_face:",
"so-meta :sparkles:", "social :coffee:",
"testing :hammer:",
"text :books:",
"training :bookmark:", "wrapper/API :honeybee:"
)
# random colors
# not colorblind-friendly
set.seed(42)
unconf_colors <- charlatan::ch_hex_color(n = length(unconf_labels))
unconf_colors <- gsub("#", "", unconf_colors)
# now post labels
post_label <- function(name, color){
gh::gh("POST /repos/:owner/:repo/labels",
owner = "ropensci",
repo = "unconf18",
name = name,
color = color)
}
purrr::walk2(unconf_labels, unconf_colors,
post_label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment