Skip to content

Update prepare_renv.yml #10

Update prepare_renv.yml

Update prepare_renv.yml #10

Workflow file for this run

name: create renv
on:
schedule:
- cron: '0 0 1 * *' # Run once every month to referesh artifact
push:
branches:
- main
pull_request:
branches:
- main
# Cacnel previous runs if a new push is sent
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
create-renv:
# Don't run if a pull request but not closed
if: github.event_name == 'schedule' || ((github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == 'true') || github.event_name == 'push')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pages: write
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# Downloading both the repositories to simulate the original task
- uses: actions/checkout@main
with:
path: ${{ github.event.repository.name }}
- uses: r-lib/actions/setup-r@v2
- run: echo "💡 The ${{ github.repository }} repository have been cloned to the runner."
- name: Set up "data commons environment"
working-directory: ${{ github.workspace }}/${{ github.event.repository.name }}
shell: Rscript {0}
run: |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
renv::init()
renv::restore()
install.packages('remotes')
remotes::install_github('uva-bi-sdad/community')
renv::snapshot()
# # Caches by default last only 10 minutes
# - name: Cache packages
# uses: actions/cache@v3
# with:
# path: ${{ github.workspace }}/${{ github.event.repository.name }}/renv
# key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
- name: print tree
run: |
tree .
- name: create an archive
run: |
zip -r${{ github.workspace }}/${{ github.event.repository.name }}/renv.zip ${{ github.workspace }}/${{ github.event.repository.name }}/renv
- uses: actions/upload-artifact@v3
if: always()
with:
name: community_renv
path: |
${{ github.workspace }}/renv.zip
retention-days: 30
# - name: Remove .gitignore inside renv/ to save binaries
# run: |
# ls -la
# rm ${{ github.workspace }}/${{ github.event.repository.name }}/renv/.gitignore
# - name: Commit files # Commit changes. You need to do this so child sites work...
# working-directory: ${{ github.event.repository.name }}
# run: |
# git config --local user.email "[email protected]"
# git config --local user.name "GitHub Actions"
# git add -A
# git commit -m "saving renv"
# git push