Skip to content

update

update #403

Workflow file for this run

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 }}