Update YPL Parameters Table #464
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
| # This workflow downloads data from a Google Sheet and updates the parameters table markdown file | |
| # It runs on a schedule (daily) and can also be triggered manually. | |
| name: Update YPL Parameters Table | |
| on: | |
| # Run automatically at midnight UTC every day | |
| schedule: | |
| - cron: '0 0 * * *' | |
| # Allow manual triggering from the GitHub Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| sheet_id: | |
| description: 'Google Sheet ID (optional override)' | |
| required: false | |
| type: string | |
| jobs: | |
| update-docs: | |
| name: Generate YPL parameters table | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.HWO_RELEASE_PLEASE_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pandas google-auth google-auth-oauthlib google-api-python-client tabulate | |
| - name: Generate parameter table from Google Sheets | |
| env: | |
| # Use the sheet ID from repository secrets | |
| GOOGLE_SHEETS_ID: ${{ secrets.GOOGLE_SHEETS_ID }} | |
| # Base64-encoded Google service account credentials | |
| GOOGLE_CREDENTIALS_B64: ${{ secrets.GOOGLE_CREDENTIALS_B64 }} | |
| run: | | |
| cd src/yieldplotlib | |
| python generate_docs.py --sheets "$GOOGLE_SHEETS_ID" --output "../../docs/user/parameters_table.md" --temp | |
| - name: Commit and push changes | |
| run: | | |
| # Configure git user for the commit | |
| git config --global user.name "GitHub Action" | |
| git config --global user.email "action@github.com" | |
| # Add the generated file to git | |
| git add docs/user/parameters_table.md | |
| # Only commit and push if there are actual changes to the file | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "Update parameters_table.md from Google Sheets" && git push) |