get hp30 #4962
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 hp30 | |
on: | |
schedule: | |
- cron: "*/10 * * * *" # Runs every 15 min | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: pip install requests | |
- name: Run Hp30 update | |
run: | | |
# Define GIT-user for updates | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git stash --quiet | |
git pull --rebase --quiet | |
# run worker for Hp30 | |
python ./worker/hp30.py | |
update_file_if_needed() { | |
local temp_file="./temp/$1_new.json" | |
local output_file="./output/$1.json" | |
if ! cmp -s "$temp_file" "$output_file"; then | |
mv -f "$temp_file" "$output_file" | |
rm -f "$temp_file" | |
git add "$output_file" | |
git commit -m "$1.json has been updated!" | |
git push --quiet | |
fi | |
} | |
update_file_if_needed "hp30_nowcast" | |
#update_file_if_needed "hp30_complete" |