sunp-generate-graphs #1057
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: sunp-generate-graphs | |
# Controls when the action will run. | |
on: | |
schedule: | |
- cron: '00 05,07 * * *' | |
workflow_dispatch: | |
jobs: | |
generate-graphs: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Load repo and install R | |
steps: | |
- name: Checkout with sunp-generate-graphs branch | |
uses: actions/checkout@v2 | |
with: | |
ref: sunp-generate-graphs | |
fetch-depth: 1 | |
- name: Set Up R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install packages | |
run: | | |
R -e 'install.packages("lubridate")' | |
R -e 'install.packages("dplyr")' | |
- name: Run R Script | |
run: Rscript sunp-generate-graphs.R | |
# Commit files ,and push | |
- name: Commit files | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add sunpMetDataFigures_$(date '+%Y-%m-%d').pdf sunpWaterQualityDataFigures_$(date '+%Y-%m-%d').pdf | |
git commit -m "sunp-generate-graphs-$(date '+%Y-%m-%d')" | |
git branch sunp-graphs | |
git push --force origin sunp-graphs | |
# Check action status. If failure, send email to notify administrators | |
- name: Send mail | |
if: ${{ failure() }} | |
uses: dawidd6/action-send-mail@v2 | |
with: | |
# mail server settings | |
server_address: smtp.gmail.com | |
server_port: 465 | |
# user credentials | |
username: ${{ secrets.EMAIL_USERNAME }} | |
password: ${{ secrets.EMAIL_PASSWORD }} | |
# email subject | |
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }} | |
# email body as text | |
body: | | |
${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }} | |
The workflow link is https://github.com/FLARE-forecast/SUNP-data/actions/runs/${{ github.run_id }} | |
# comma-separated string, send email to | |
to: [email protected], [email protected] | |
# from email name | |
from: FLARE |