forked from pharmaverse/admiraltemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 1.95 KB
/
lintr.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main
- devel
- pre-release
pull_request:
branches:
- main
- devel
- pre-release
name: Lint
concurrency:
group: lint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
if: >
!contains(github.event.commits[0].message, '[skip lint]')
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
##################### BEGIN boilerplate steps #####################
- name: Get branch names 🌿
id: branch-name
uses: tj-actions/[email protected]
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
- name: Setup R 📊
uses: r-lib/actions/setup-r@v1
with:
r-version: 3.6
- name: Restore cache
uses: actions/cache@v3
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: ${{ runner.os }}-renv-
- name: Run Staged dependencies 🎦
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
SD_ENABLE_CHECK: false
SD_GIT_REF: ${{ steps.branch-name.outputs.base_ref_branch }}
##################### END boilerplate steps #####################
- name: Lint
run: |
lints <- lintr::lint_package()
saveRDS(lints, file = "lints.rds")
shell: Rscript {0}
- name: Error if lints are detected
run: |
lints <- readRDS("lints.rds")
if (length(lints) > 0L) {
stop("Lints detected. Please review and adjust code according to the comments provided.", call. = FALSE)
}
shell: Rscript {0}