-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (57 loc) · 2.17 KB
/
Copy pathspelling.yaml
File metadata and controls
68 lines (57 loc) · 2.17 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
name: spelling
permissions: read-all
# Cancel a superseded run (e.g. a newer push to the same ref) so its minutes
# are not wasted completing.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
spelling:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::spelling
needs: website
# English documentation only. Spanish README.md / vignettes/*.Rmd are
# user-facing and would fail the en-US dictionary.
- name: Spelling
shell: Rscript {0}
run: |
files <- c(
list.files("man", pattern = "\\.Rd$", ignore.case = TRUE, full.names = TRUE),
list.files("vignettes", pattern = "\\.en\\.(Rmd|qmd|Rnw)$", ignore.case = TRUE,
full.names = TRUE, recursive = TRUE),
"README.en.md"
)
desc <- read.dcf("DESCRIPTION")[1, ]
# spell_check_package() auto-ignores the package name; replicate that
# so Rd files that reference the package name do not fail.
words <- unique(c(spelling::get_wordlist(), desc[["Package"]]))
res <- spelling::spell_check_files(files, ignore = words)
# Keep the DESCRIPTION Title/Description coverage that
# spell_check_package() used to provide.
res_desc <- spelling::spell_check_text(
paste(desc[["Title"]], desc[["Description"]]),
ignore = words
)
res <- rbind(res, res_desc)
if (nrow(res) > 0) {
print(res)
stop("Spelling errors found (see inst/WORDLIST for accepted words).")
}
cat("No spelling errors found.\n")