Check Google Drive Storage #25
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: Check Google Drive Storage | |
on: | |
schedule: | |
- cron: "0 */6 * * *" # Run every 6 hours | |
workflow_dispatch: # Allow manual triggers | |
jobs: | |
check-storage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ secrets.PYTHON_VERSION }} | |
- name: Create Service Account File | |
run: | | |
echo '${{ secrets.MADBOULDER_F1887F0310EC_ENV }}' > madboulder-f1887f0310ec.env | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Check Drive Storage | |
id: check_storage | |
run: | | |
echo "::notice title=Checking Google Drive Storage::" | |
if ! python -c "from utils.drive import check_storage; exit(0 if check_storage() else 1)"; then | |
echo "::warning title=Low Storage Alert::Google Drive storage is below 200MB!" | |
exit 1 | |
fi |