Skip to content

🛠️ Auto-refresh 3-D-Print Checklist (Wiki) #382

🛠️ Auto-refresh 3-D-Print Checklist (Wiki)

🛠️ Auto-refresh 3-D-Print Checklist (Wiki) #382

# .github/workflows/update-wiki-print-table.yml
name: 🛠️ Auto-refresh 3-D-Print Checklist (Wiki)
on:
# run every time anything in 3D_Printing/ changes…
push:
paths: ["3D_Printing/**"]
# …plus a nightly safety-net
schedule:
- cron: "0 3 * * *" # 03:00 UTC
permissions:
contents: read # checkout needs this (wiki pushes use PAT below)
jobs:
refresh:
runs-on: ubuntu-latest
steps:
# 1️⃣ Pull main repo — for the generator script & models
- name: Check out code
uses: actions/checkout@v4
# 2️⃣ Clone the Wiki repo (needs a token with *write* access)
- name: Clone wiki repo
env:
# Use your PAT if set, otherwise the built-in token
GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TOKEN="${GH_PAT:-$GITHUB_TOKEN}"
git clone "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}.wiki.git" wiki
# 3️⃣ Set up Python
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
# 4️⃣ Install dependencies
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install PyGithub tabulate markdown-it-py pyyaml
# 5️⃣ Regenerate the table (preserve check-marks, merge .meta.yml)
- name: Generate checklist markdown
env:
GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python scripts/make_print_table.py \
--wiki-path wiki \
--page "Build-Instruction:-3D-Printed-Parts.md"
# 6️⃣ Commit & push only if the file changed
- name: Commit & push update
env:
GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
cd wiki
git add "Build-Instruction:-3D-Printed-Parts.md"
if git diff --cached --quiet; then
echo "No changes – wiki already up to date."
else
git config user.name "Mimic-CI Bot"
git config user.email "actions@github.com"
git commit -m "docs: auto-refresh 3-D print checklist [skip ci]"
TOKEN="${GH_PAT:-$GITHUB_TOKEN}"
git push "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}.wiki.git" HEAD:master
fi