-
Notifications
You must be signed in to change notification settings - Fork 30
49 lines (42 loc) · 1.77 KB
/
update.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
name: update
on:
workflow_dispatch:
schedule:
- cron: "0 5,11 * * *"
concurrency:
group: ${{ github.ref }}
jobs:
run:
name: Update data
runs-on: the-economist-war-fire-model
container:
image: ghcr.io/theeconomist/the-economist-war-fire-model:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
lfs: true
- name: Run R script
run: |
. /opt/conda/etc/profile.d/conda.sh && conda activate base
cat output-data/model-objects/boot_predictions.csv.* > output-data/model-objects/boot_predictions.csv
Rscript -e "source('scripts/000-autoupdater.R')"
split -l 500000 output-data/model-objects/boot_predictions.csv output-data/model-objects/boot_predictions.csv.
shell: bash
env:
FIRMS_API_KEY: ${{ secrets.FIRMS_API_KEY }}
- name: Commit changes
run: |
git config --global --add safe.directory /__w/the-economist-war-fire-model/the-economist-war-fire-model
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add output-data/model-objects
git commit --allow-empty -m "Data auto-update" -a
git push
- name: Report failure
if: failure()
run: |
curl -X POST -H "Content-type: application/json" --data '{ "channel":"${{ secrets.SLACK_CHANNEL }}", "text":":x: <@UTBFTA7Q9> <@U02N72XERFW> The Economist War Fire Model failed to update. Please check the logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "unfurl_links": false }' ${{ secrets.SLACK_WEBHOOK }}