-
Notifications
You must be signed in to change notification settings - Fork 9
47 lines (40 loc) · 1.28 KB
/
style.yml
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
name: Check Style 🎨
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: style-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
style:
name: Check code style 🧑🎨
runs-on: ubuntu-latest
if: >
!contains(github.event.commits[0].message, '[skip stylecheck]')
&& github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
with:
path: ${{ github.event.repository.name }}
fetch-depth: 0
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install styler 🖌️
run: install.packages(c("styler", "knitr", "roxygen2"), repos = "https://cloud.r-project.org")
shell: Rscript {0}
- name: Run styler 🖼️
run: |
detect <- styler::style_pkg(dry = "on")
if (TRUE %in% detect$changed) {
problems <- subset(detect$file, detect$changed == T)
cat(paste("Styling errors found in", length(problems), "files\n"))
cat("Please run `styler::style_pkg()` to fix the style\n")
quit(status = 1)
}
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}