-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (49 loc) · 1.94 KB
/
Copy pathgenerate_parameters_docs.yml
File metadata and controls
59 lines (49 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 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@v7
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)