Render README #36892
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: Render README | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '27 * * * *' | |
jobs: | |
render: | |
name: Render README | |
runs-on: ubuntu-latest | |
env: | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }} | |
ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.3.0' | |
use-public-rspm: true | |
- name: Setup Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Cache packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.RENV_PATHS_ROOT }} | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Restore packages | |
shell: Rscript {0} | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
- name: Render README | |
run: Rscript -e 'rmarkdown::render("README.Rmd")' | |
# - name: Clean README | |
# Remove the extra tweet images because I can't work out stop them | |
# run: sed -i '' '/width="0"/d' README.md | |
- name: Commit results | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git commit -a -m 'Re-build README.Rmd' || echo "No changes to commit" | |
git push origin || echo "Done!" |