Run CRAN Package Analysis #7
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
name: Run CRAN Package Analysis | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs weekly on Sunday at midnight UTC | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
analyze-packages: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Para poder hacer push | |
issues: write # Para crear issues en caso de fallo | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libxml2-dev | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 'release' | |
- name: Install required R packages | |
run: | | |
Rscript -e 'install.packages(c("pacman","dplyr", "readr", "janitor", "tableHTML", "rvest", "knitr", "rmarkdown"), repos="https://cloud.r-project.org")' | |
- name: Run R script | |
run: Rscript "CRAN Package Tables.R" | |
- name: Configure Git | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
- name: Commit and push changes | |
run: | | |
git add *.html *.csv | |
git commit -m "Update CRAN analysis results [skip ci]" || echo "No changes to commit" | |
git push | |
- name: Upload analysis results | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: cran-analysis-results | |
path: | | |
*.html | |
*.csv | |
- name: Notify on failure | |
if: failure() | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: 'CRAN Analysis Workflow Failed', | |
body: `Workflow run failed: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | |
}) |