Skip to content

Run Python Script

Run Python Script #7

name: Run Python Script
on:
# Run the workflow every day at midnight (00:00) UTC.
workflow_dispatch: # Allows manual triggering
schedule:
- cron: '0 0 * * *'
jobs:
run-python-script:
runs-on: ubuntu-latest # Use Ubuntu as the runner environment
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12' # Specify the Python version (e.g., '3.x')
# Step 3: Install dependencies (optional, if your script has requirements)
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
# Step 4: Run your Python script
- name: Run Python script
run: python ./scripts/check_openapi_version.py
- name: Send notification
if: failure()
uses: dawidd6/action-send-mail@v2
with:
server_address: email-smtp.eu-central-1.amazonaws.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "[Plenigo][WARNING] Plenigo openapi spec version mismatch"
body: "There is a version mismatch between the openapi spec in prod and the latest released version."
to: plenigo_openapi_spec-aaaaooflpibdbm4k3xoaxq7uye@spring-media.slack.com
from: '"User" <[email protected]>' # <[email protected]>
- name: Send notification
if: success()
uses: dawidd6/action-send-mail@v2
with:
server_address: email-smtp.eu-central-1.amazonaws.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "[Plenigo][SUCCESS] Plenigo openapi spec version is up to date."
body: "We are currently using the latest released version and no action is needed"
to: plenigo_openapi_spec-aaaaooflpibdbm4k3xoaxq7uye@spring-media.slack.com
from: '"User" <[email protected]>' # <[email protected]>