-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.67 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Update-data
on:
#schedule:
# - cron: "00 11,17 * * *"
workflow_dispatch:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RENV_PATHS_ROOT: ~/.local/share/renv
jobs:
generate-data:
runs-on: ubuntu-latest
container: docker://ade711/dads_r_v1:latest
steps:
- uses: actions/checkout@v2 # Checkout branch into the runner
- name: Setup R
uses: r-lib/actions/setup-r@master # Set up R runtime
# Set-up Dependencies
- name: Set up dependencies
run: |
R -e 'install.packages("renv")'
R -e 'install.packages("usethis")'
#R -e 'renv::restore()'
- name: Cache packages
uses: actions/cache@v2
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: Run scripts # Run the script
env:
DW_TOKEN: ${{ secrets.DW_ACTIONS }}
ACTIONSGOOGLE_PASSWORD: ${{ secrets.ACTIONSGOOGLE_PASSWORD }}
#DW_TOKEN: ${{ secrets.DW_ACTIONS }}
run: R -e 'renv::run("./scripts/refugees_UNHCR.R")'
#run: source("./scripts/refugees_UNHCR.R")
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git diff-index --quiet HEAD || (git commit -m "update data" && git push)