Update Meta files #30
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: Update Meta files | |
on: | |
push: | |
paths: | |
- contributions.json | |
- .github/workflows/updateRepo.yaml | |
- ReadMe.Rmd | |
- contribute.Rmd | |
schedule: | |
- cron: '0 0 1 * *' # every month | |
jobs: | |
render: | |
name: Update meta files | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Cache Renv packages | |
uses: r-lib/actions/setup-renv@v2 | |
- name: Update meta file with contributions | |
run: | | |
library(MOrepoTools) | |
MOrepoTools:::setMetaContributions() | |
shell: Rscript {0} | |
- name: Commit results | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git commit metaContributions.json -m 'Update meta contributions' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" | |
# - name: Sleep for 60 seconds | |
# uses: juliangruber/sleep-action@v1 | |
# with: | |
# time: 60s | |
- name: Updtate meta file with instances | |
run: | | |
library(MOrepoTools) | |
r <- FALSE | |
for(i in 1:10){ | |
try({ | |
r <- MOrepoTools:::setMetaInstances() # may get Forbidden (HTTP 403) due to rate limit | |
break | |
}, silent = FALSE) | |
} | |
if (!r) stop("Could not update metaInstances.json") | |
shell: Rscript {0} | |
- name: Commit results | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git commit metaInstances.json -m 'Update meta instances' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" | |
- name: Updtate meta file with results | |
run: | | |
library(MOrepoTools) | |
r <- FALSE | |
for(i in 1:10){ | |
try({ | |
r <- MOrepoTools:::setMetaResults() | |
break | |
}, silent = FALSE) | |
} | |
if (!r) stop("Could not update metaIResuls.json") | |
shell: Rscript {0} | |
- name: Commit results | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git commit metaResults.json -m 'Update meta results' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" | |
- name: Render Rmarkdown files | |
run: | | |
Rscript -e 'rmarkdown::render("ReadMe.Rmd", output_format = "github_document", output_file = "ReadMe.md")' | |
Rscript -e 'rmarkdown::render("contribute.Rmd", output_format = "github_document", output_file = "contribute.md")' | |
- name: Commit results | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
git commit *.md -m 'Re-build Rmarkdown files' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" |