Skip to content

Check for new Swagger release 🕵️‍♂️ #3

Check for new Swagger release 🕵️‍♂️

Check for new Swagger release 🕵️‍♂️ #3

name: "Check for new Swagger release 🕵️‍♂️"
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: "Check out repository 🚚"
uses: actions/checkout@v4
- name: "Print some debug info 🐞"
run: |
echo "Current directory: $(pwd)"
echo "Files in the current directory: $(ls)"
- name: "Set up Python 🐍"
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: "Install python libraries 📚"
run: python -m pip install requests
- name: "Check for new Swagger release 🕵️‍♂️"
working-directory: .
run: python check_swagger.py
# It will set SWAGGER_UI_UPDATED and SWAGGER_UI_VERSION env variables
# If there is a new release, then needed files will be updated
- name: "Make a commit if needed 📝"
run: |
if [ "$SWAGGER_UI_UPDATED" = "true" ]; then
git config --global user.email "[email protected]"
git config --global user.name "Automated Swagger UI update"
git add 'fastapi_swagger/resources'
git add 'latest_release.txt`
git commit -m "chore: update Swagger UI to $SWAGGER_UI_VERSION"
git push
fi