-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.64 KB
/
generate_output_docs.yml
File metadata and controls
50 lines (41 loc) · 1.64 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
name: Generate Output Docs
# ─────────────────────────────────────────────
# TRIGGER: runs whenever output_*.png files are
# pushed to any Lab-* folder
# ─────────────────────────────────────────────
on:
push:
paths:
- 'Lab-*/output_*.png'
- 'Lab-*/outputzoomed.png'
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
# Step 1: Download the repo onto the Ubuntu machine
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Install Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# Step 3: Install python-docx library
- name: Install dependencies
run: pip install python-docx
# Step 4: Create the CG-Lab-Outputs folder if it doesn't exist
- name: Create output directory
run: mkdir -p CG-Lab-Outputs
# Step 5: Run the script — generates all docx files
- name: Run generate_output_doc.py
run: python generate_output_doc.py
# Step 6: Commit and push the generated docx files back to the repo
- name: Commit and push output docs
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CG-Lab-Outputs/
git diff --staged --quiet || git commit -m "Auto-generate output docs [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}