Skip to content

Add a workflow to generate folder images #1533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Generate folder images

on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches: [master]

concurrency:
group: folder-images
cancel-in-progress: true

jobs:
update-images:
runs-on: ubuntu-20.04
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

- uses: actions/[email protected]

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- 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