-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (128 loc) Β· 4.96 KB
/
roxygen.yaml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
name: Roxygen π
Ύ
on:
push:
branches:
- main
- pre-release
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
- pre-release
workflow_dispatch:
workflow_call:
inputs:
install-system-dependencies:
description: Check for and install system dependencies
required: false
default: false
type: boolean
enable-staged-dependencies-check:
description: Enable staged dependencies YAML check
required: false
default: false
type: boolean
auto-update:
description: If man pages are not up-to-date, they will be automatically updated and committed back to the branch.
required: false
default: false
type: boolean
secrets:
GITHUB_TOKEN:
description: |
Github token with read access to repositories, required for staged.dependencies installation
required: false
concurrency:
group: roxygen-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
roxygen:
name: Manual pages check π
runs-on: ubuntu-latest
if: >
!contains(github.event.commits[0].message, '[skip roxygen]')
&& github.event.pull_request.draft == false
container:
image: ghcr.io/insightsengineering/rstudio_4.2.1_bioc_3.15:latest
steps:
- name: Get branch names πΏ
id: branch-name
uses: tj-actions/branch-names@v5
- name: Checkout repo π
uses: actions/checkout@v3
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
path: ${{ github.event.repository.name }}
fetch-depth: 0
- name: Run Staged dependencies π¦
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: ${{ inputs.install-system-dependencies }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
SD_REPO_PATH: ${{ github.event.repository.name }}
SD_ENABLE_CHECK: ${{ inputs.enable-staged-dependencies-check }}
- name: Generate man pages π
run: |
setwd("${{ github.event.repository.name }}")
logfile <- "roxygen_${{ github.event.repository.name }}.log"
con <- file(logfile)
sink(con, append = TRUE, split = TRUE)
sink(con, append = TRUE, type = "message")
roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))
sink()
sink(type = "message")
logs <- readLines(logfile)
error_marker <- grep("Error:", logs)
warnings_marker <- grep("Warning message", logs)
if (length(warnings_marker) > 0) {
cat("β One or more warnings were generated during the roxygen build:\n")
cat(logs[warnings_marker[[1]]:length(logs)], sep = "\n")
stop("Please π fix the warnings shown below this message π")
}
if (length(error_marker) > 0) {
cat("β One or more errors were generated during the roxygen build:\n")
cat(logs[error_marker[[1]]:length(logs)], sep = "\n")
stop("Please π fix the errors shown below this message π")
}
shell: Rscript {0}
- name: Roxygen check π
Ύ
run: |
cd ${{ github.event.repository.name }}
git status -s
if [[ -n `git status -s | grep man` ]]
then {
ROXYGEN_VERSION="$(Rscript -e 'packageVersion("roxygen2")' | awk '{print $NF}')"
echo "π Manuals are not up-to-date with roxygen comments!"
echo "π The following differences were noted:"
git diff man/*
if [ "${{ inputs.auto-update }}" == "true" ]
then {
echo "Regenerating man pages via auto-update"
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add man/*
git commit -m "[skip actions] ROxygen Man Pages Auto Update"
git pull origin ${GITHUB_HEAD_REF}
git push -v origin ${GITHUB_HEAD_REF}
}
else {
echo -e "\nπ» Please rerun the following command on your workstation and push your changes"
echo "--------------------------------------------------------------------"
echo "roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))"
echo "--------------------------------------------------------------------"
echo "βΉ roxygen2 version that was used in this workflow: $ROXYGEN_VERSION"
echo "π Please ensure that the 'RoxygenNote' field in the DESCRIPTION file matches this version"
}
fi
exit 1
} else {
echo "π Manuals are up-to-date with roxygen comments"
}
fi
shell: bash