Skip to content

.github/workflows/geine_delete.yml #17

.github/workflows/geine_delete.yml

.github/workflows/geine_delete.yml #17

Workflow file for this run

name: Trigger API Call Every 12 Hours
on:
schedule:
# Runs every 12 hours
- cron: "0 */12 * * *"
jobs:
trigger-api:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10" # Adjust the version as needed
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
# Run the Python script
- name: Trigger API Call
run: |
python <<EOF
import requests
url = "https://sahanweerasiri.pythonanywhere.com/api/delete"
try:
response = requests.get(url)
if response.status_code == 200:
print("API call successful!")
print("Response:", response.json())
else:
print(f"Failed to call the API. Status Code: {response.status_code}")
print("Error:", response.text)
except Exception as e:
print("An error occurred:", str(e))
EOF