CRAN synchronization #4613
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
paths: | |
- .github/workflows/update.yml | |
- update.R | |
schedule: | |
## Run twice an hour | |
- cron: '5,35 * * * *' | |
name: "CRAN synchronization" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Git | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- uses: r-lib/actions/setup-r@v2 | |
- name: Install R dependencies | |
run: install.packages("jsonlite") | |
shell: Rscript {0} | |
- name: Refresh packages.json | |
run: | | |
git fetch --all | |
git pull | |
Rscript update.R | |
mapfile -t pkgs < <(grep -F package packages.json) | |
echo "Number of CRANhaven packages: ${#pkgs[@]}" | |
- name: Commit and Push Changes | |
run: | | |
git add packages.json | |
git commit -m "Synchronized with CRAN" || echo "No changes to commit" | |
git push |