Add cron job and script for generating expenses
This commit is contained in:
30
.github/workflows/appletune_cron.yml
vendored
Normal file
30
.github/workflows/appletune_cron.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Cron Appletune
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
Anilist:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: "pip" # caching pip dependencies
|
||||
|
||||
- name: Install Pip dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
- name: Run Anylist
|
||||
run: python ./action_script/appletune_run.py
|
||||
13
action_script/appletune_run.py
Normal file
13
action_script/appletune_run.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import requests
|
||||
|
||||
url_api = "https://fundor333.com/pantalone/genera-spese"
|
||||
|
||||
# Call the API to generate expenses
|
||||
response = requests.get(url_api)
|
||||
if response.status_code == 200:
|
||||
print("Expenses generated successfully.")
|
||||
else:
|
||||
print(f"Failed to generate expenses. Status code: {response.status_code}")
|
||||
# raise an error for the github action to fail
|
||||
|
||||
raise Exception(f"API call failed with status code: {response.status_code}\n")
|
||||
Reference in New Issue
Block a user