Run Python Script #51
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: 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 | |
id: check_openapi_version | |
run: python ./scripts/check_openapi_version.py | |
- name: Send notification | |
if: failure() | |
uses: dawidd6/action-send-mail@v3 | |
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" | |
html_body: file://output.log | |
to: plenigo_openapi_spec-aaaaooflpibdbm4k3xoaxq7uye@spring-media.slack.com | |
from: '"User" <[email protected]>' # <[email protected]> | |