Get CA fire and evac data #173
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Get CA fire and evac data | |
on: | |
schedule: | |
- cron: '30 1,10,12,16,19,22 * * *' # Runs at 15 minutes past every hour | |
workflow_dispatch: # Allows manual trigger | |
jobs: | |
run-script: | |
runs-on: macos-latest | |
steps: | |
# Step 1: Checkout the repository | |
# Checks out the repository so that the workflow can access the files. | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Install system dependencies | |
# Installs necessary system libraries and tools using Homebrew. | |
- name: Install system dependencies | |
run: | | |
brew install gdal # Geospatial Data Abstraction Library | |
# Step 3: Set up R | |
# Sets up R on the runner using the r-lib/actions/setup-r action. | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
# Step 4: Install R packages | |
# Installs the necessary R packages required by the script. | |
- name: Install R packages | |
run: | | |
Rscript -e 'install.packages(c("tidyverse", "sf", "httr", "geojsonio", "janitor", "lubridate"))' | |
# Step 5: Run R script | |
# Runs the R script located in the scripts directory. | |
- name: Run R script | |
run: | | |
Rscript scripts/cali_fires_start.R | |
# Step 6: Commit and push changes | |
# Configures Git, adds changes, commits them, and pushes to the repository | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m 'Update fire and evac data' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |