Skip to content

Update Flag Status and Deploy #163

Update Flag Status and Deploy

Update Flag Status and Deploy #163

name: Update Flag Status and Deploy
on:
schedule:
- cron: '0 */6 * * *' # Run every 6 hours
workflow_dispatch: # Allow manual triggers
push:
branches: [ main ] # Run on pushes to main
jobs:
update-status:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check flag status
env:
OPM_API_KEY: ${{ secrets.OPM_API_KEY }}
THIRD_PARTY_API_KEY: ${{ secrets.THIRD_PARTY_API_KEY }}
run: python src/api/check_status.py
- name: Configure Git
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
- name: Commit and push changes
run: |
git add flag_status.json
git diff --quiet && git diff --staged --quiet || (git commit -m "Update flag status" && git push)
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}