File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Detect any attempts to call sudo during R CMD check.
2+ # pak's sysreqs feature probes for passwordless sudo, which CRAN flags.
3+ # This workflow confirms that we successfully suppress that probe.
4+ on :
5+ push :
6+ branches : [main, master]
7+ pull_request :
8+
9+ name : sudo-tripwire.yaml
10+
11+ permissions : read-all
12+
13+ jobs :
14+ sudo-tripwire :
15+ runs-on : ubuntu-latest
16+
17+ env :
18+ GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
19+ R_KEEP_PKG_SOURCE : yes
20+
21+ steps :
22+ - uses : actions/checkout@v4
23+
24+ - uses : r-lib/actions/setup-pandoc@v2
25+
26+ - uses : r-lib/actions/setup-r@v2
27+ with :
28+ r-version : release
29+ use-public-rspm : true
30+
31+ - uses : r-lib/actions/setup-r-dependencies@v2
32+ with :
33+ extra-packages : any::rcmdcheck
34+ needs : check
35+
36+ - name : Install sudo tripwire
37+ run : |
38+ mkdir -p "$HOME/bin"
39+ cat > "$HOME/bin/sudo" << 'EOF'
40+ #!/bin/bash
41+ echo "SUDO CALLED with args: $*" >&2
42+ exit 1
43+ EOF
44+ chmod +x "$HOME/bin/sudo"
45+ echo "$HOME/bin" >> $GITHUB_PATH
46+
47+ - uses : r-lib/actions/check-r-package@v2
48+ with :
49+ upload-snapshots : true
50+ build_args : ' c("--no-manual","--compact-vignettes=gs+qpdf")'
51+
52+ - name : Check for sudo calls
53+ if : always()
54+ run : |
55+ if grep -r "SUDO CALLED" '${{ runner.temp }}/package.Rcheck/' 2>/dev/null; then
56+ echo "::error::sudo was called during R CMD check!"
57+ exit 1
58+ else
59+ echo "No sudo calls detected."
60+ fi
You can’t perform that action at this time.
0 commit comments