Skip to content

Generate folder images #2473

Generate folder images

Generate folder images #2473

Workflow file for this run

name: Generate folder images
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches: [main]
concurrency:
group: folder-images-concurrency # https://github.com/adafruit/Adafruit_Learning_System_Guides/issues/2327
cancel-in-progress: true
jobs:
update-images:
if: github.repository_owner == 'adafruit'
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Checkout screenshot maker
run: git clone --depth=1 https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker
- name: Install dependencies
run: pip install -r CircuitPython_Library_Screenshot_Maker/requirements.txt
- name: Generate images
run: |
cd CircuitPython_Library_Screenshot_Maker
env LEARN_GUIDE_REPO=../ python3 ./create_requirement_images.py
- name: Commit updates
run: |
cd CircuitPython_Library_Screenshot_Maker/generated_images
git config --global user.name "${GITHUB_ACTOR} (github actions cron)"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global init.defaultBranch main
git init
for i in *.png; do echo "<a href=\"$i\">$i</a><br>"; done > index.html
git add *.png index.html
git remote add origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
if git commit -m"update images"; then git push -f origin HEAD:folder-images; fi