Skip to content

Commit 48ece3b

Browse files
Add cran-status-check workflow (#7175)
* Add cran-status-check workflow Fix #7008 Supersedes #7020 * Add NOTE in NEWS for this change * Exit early to reduce nesting * Add link to workflow run in issue body * nit: consistent spacing around status emoji * simplify (IMO) * use subset() to avoid temp crandb --------- Co-authored-by: Michael Chirico <[email protected]>
1 parent f87ba2f commit 48ece3b

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
workflow_dispatch:
3+
schedule:
4+
- cron: '0 6 * * 1,3,5' # Runs at 06:00 on Mon/Wed/Fri
5+
6+
name: check-cran-status
7+
8+
jobs:
9+
fetch-deadlines:
10+
runs-on: ubuntu-latest
11+
env:
12+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
13+
permissions:
14+
issues: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: r-lib/actions/setup-r@v2
19+
with:
20+
use-public-rspm: true
21+
22+
- uses: r-lib/actions/setup-r-dependencies@v2
23+
with:
24+
packages: |
25+
gh
26+
glue
27+
28+
- name: Check for existing CRAN issues
29+
id: check-issues
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
# Count open issues with CRAN-related labels
34+
ISSUE_COUNT=$(gh issue list --label "cran-deadline" --state open --json number | jq length)
35+
if [ $ISSUE_COUNT -eq 0 ]; then
36+
echo "should-run=true" >> $GITHUB_OUTPUT
37+
echo "✅ Will run CRAN check"
38+
else
39+
echo "should-run=false" >> $GITHUB_OUTPUT
40+
echo "⏭️ Skipping CRAN check - existing issues found"
41+
fi
42+
43+
- name: Fetch deadline for this package
44+
if: steps.check-issues.outputs.should-run == 'true'
45+
shell: Rscript {0}
46+
run: |
47+
pkgname <- drop(read.dcf("DESCRIPTION", "Package"))
48+
49+
deadline <- subset(tools::CRAN_package_db(), Package == pkgname, "Deadline", drop=TRUE)
50+
51+
if (is.na(deadline)) {
52+
quit()
53+
}
54+
55+
gh::gh(
56+
"POST /repos/{owner_repo}/issues",
57+
owner_repo = Sys.getenv("GITHUB_REPOSITORY"),
58+
title = paste("Fix CRAN R CMD check issues by", deadline),
59+
body = glue::glue(
60+
"This package is failing CRAN checks and is at risk of archival.",
61+
"https://cran.r-project.org/web/checks/check_results_{pkgname}.html",
62+
"This issue was opened by https://github.com/{Sys.getenv('GITHUB_REPOSITORY')}/actions/runs/{Sys.getenv('GITHUB_RUN_ID')}.",
63+
.sep = "\n\n"
64+
),
65+
labels = list("cran-deadline")
66+
)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
104104
4. The default `format_list_item()` method (and hence `print.data.table()`) annotates truncated list items with their length, [#605](https://github.com/Rdatatable/data.table/issues/605). Thanks Matt Dowle for the original report (2012!) and @MichaelChirico for the fix.
105105
106+
5. A GitHub Actions workflow is now in place to warn the entire maintainer team, as well as any contributor following the GitHub repository, when the package is at risk of archival on CRAN [#7008](https://github.com/Rdatatable/data.table/issues/7008). Thanks @tdhock for the original report and @Bisaloo and @TysonStanley for the fix.
107+
106108
# data.table [v1.17.8](https://github.com/Rdatatable/data.table/milestone/41) (6 July 2025)
107109
108110
1. Internal functions used to signal errors are now marked as non-returning, silencing a compiler warning about potentially unchecked allocation failure. Thanks to Prof. Brian D. Ripley for the report and @aitap for the fix, [#7070](https://github.com/Rdatatable/data.table/pull/7070).

0 commit comments

Comments
 (0)