Skip to content

Commit

Permalink
Narrowing in on successful identification of files in a GitHub repo
Browse files Browse the repository at this point in the history
  • Loading branch information
njlyon0 committed Jul 6, 2023
1 parent dadcb70 commit 8a8706d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions dev/spell-exploration.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,48 @@

# Load libraries
librarian::shelf(tidyverse, dndR)
# librarian::shelf(oganm/wizaRd)

# Grimoire link (list of 5e spells)
## https://github.com/Traneptora/grimoire/tree/master

# Load needed library
library(httr)


library(gh)

grim_conts <- gh::gh("/repos/Traneptora/grimoire/contents")
str(grim_conts)


for(i in 1:length(grim_conts)){

message("Element ", i, " is ", grim_conts[[i]]$name)

}


grim_conts[[11]]


# Grab the contents of that repo
grimoire_gh <- httr::GET(url = paste0("https://api.github.com/repos/Traneptora/grimoire/tree/master", "?recursive=1"))
grimoire_gh


httr::GET(url = "")

# Check for warnings / errors
httr::stop_for_status(x = grimoire_gh)

# Access files in that link
httr::content(x = grimoire_gh)$tree





# Can read Markdown in GitHub Grimoire from R
base::readLines(con = url("https://raw.githubusercontent.com/Traneptora/grimoire/master/_posts/2014-08-24-acid-splash.markdown"))

Expand Down

0 comments on commit 8a8706d

Please sign in to comment.