-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (46 loc) · 1.76 KB
/
bot.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
name: "Update Bot"
on:
schedule:
- cron: '0 * * * *' # run the bot once an hour (at every minute 0 on the clock)
push: # also run the action when something on a new commit
branches:
- main
pull_request:
branches:
- main
jobs:
blog-updates:
name: bot
runs-on: ubuntu-22.04
steps:
# you can use this action to install R
- uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
# this one makes sure the files from your repo are accessible
- name: Setup - Checkout repo
uses: actions/checkout@v2
# these dependencies are needed for pak to install packages
- name: System dependencies
run: sudo apt-get install -y libcurl4-openssl-dev
# I created this custom installation of depenencies since the pre-pacakged one
# from https://github.com/r-lib/actions only works for repos containing R packages
- name: "Install Packages"
run: |
install.packages(c("pak", "renv"))
deps <- unique(renv::dependencies(".")$Package)
# use github version for now
deps[deps == "atrrr"] <- "JBGruber/atrrr"
deps <- c(deps, "jsonlite", "magick", "dplyr")
# should handle remaining system requirements automatically
pak::pkg_install(deps)
shell: Rscript {0}
# after all the preparation, it's time to run the bot
- name: "Bot - Run"
run: Rscript 'bot.r'
env:
ATR_PW: ${{ secrets.ATR_PW }} # to authenticat, store your app pw as a secret
# after 60 days without a commit, the bot is disabled by GitHub. keepalive-workflow
# prevents that
- name: Keepalive Workflow
uses: gautamkrishnar/keepalive-workflow@2.0.7