Daily Weather Forecast #125
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: Daily Weather Forecast | |
on: | |
schedule: | |
# Runs every hour | |
- cron: '0 */3 * * *' | |
workflow_dispatch: | |
inputs: | |
timedelta_hours: | |
type: string | |
description: Look into future for this many hours | |
required: false | |
jobs: | |
forecast: | |
runs-on: ubuntu-latest | |
environment: API_KEYS | |
steps: | |
- name: Echo variables | |
run: | | |
echo hours override: [${{ inputs.timedelta_hours }}] | |
echo config hours: [${{ vars.GC_TIMEDELTA_HOURS }}] | |
echo config lat: [${{ vars.LAT }}] | |
echo config lon: [${{ vars.LON }}] | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Install Pipenv | |
run: pip install pipenv | |
- name: Install dependencies using Pipenv | |
run: | | |
pipenv install --deploy --ignore-pipfile | |
- name: Run forecast.py using Pipenv | |
run: | | |
if [ "${{ inputs.timedelta_hours }}" ]; then | |
export GC_TIMEDELTA_HOURS=${{ inputs.timedelta_hours }} | |
fi | |
cd src | |
pipenv run python job.py | |
env: | |
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }} | |
OW_API_KEY: ${{ secrets.OW_API_KEY }} | |
GC_API_KEY: ${{ secrets.GC_API_KEY }} | |
GC_ID: ${{ secrets.GC_ID }} | |
GC_TIMEDELTA_HOURS: ${{ vars.GC_TIMEDELTA_HOURS }} | |
LAT: ${{ vars.LAT }} | |
LON: ${{ vars.LON }} | |