-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathbefore-build-spellcheck.R
More file actions
41 lines (40 loc) · 930 Bytes
/
before-build-spellcheck.R
File metadata and controls
41 lines (40 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if (!requireNamespace("gh")){
install.packages("gh")
}
if (!requireNamespace("spelling")){
install.packages("spelling")
}
if (!requireNamespace("knitr")){
install.packages("knitr")
}
try({
gh::gh(
"POST /repos/:owner/:repo/issues",
owner = gsub("([^/]*)/.*", "\\1", Sys.getenv("GITHUB_REPOSITORY")),
repo = gsub("[^/]*/(.*)", "\\1", Sys.getenv("GITHUB_REPOSITORY")),
title = sprintf(
"Spellcheck GA %s - %s",
Sys.getenv("GITHUB_ACTION"), Sys.Date()
),
.token = Sys.getenv("GH_TOKEN"),
body = paste(
capture.output(
knitr::kable(
do.call(
rbind,
lapply(
list.files(
path = ".",
pattern = ".Rmd$"
),
function(x){
spelling::spell_check_files(x)
}
)
)
)
),
collapse = "\n"
)
)
})