Generate README from Firebase #249
This file contains hidden or 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: Generate README from Firebase | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' # Runs at 03:00 UTC every day | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| generate-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| cache: 'pip' | |
| - name: Create pip cache directory | |
| run: | | |
| mkdir -p ~/.cache/pip | |
| chmod 777 ~/.cache/pip | |
| - name: Checkout main and pull | |
| run: | | |
| git checkout main | |
| git pull | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip --no-cache-dir | |
| pip install --no-cache-dir -r scripts/requirements.txt | |
| - name: Generate README from Firebase | |
| run: python scripts/generate_readme_from_firebase.py | |
| env: | |
| GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
| FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | |
| FIREBASE_PLATFORM_COLLECTION: ${{ secrets.FIREBASE_PLATFORM_COLLECTION }} | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add README.md | |
| git diff --quiet && git diff --staged --quiet || git commit -m "Auto-update README from Firebase data [skip ci]" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |