Skip to content

Commit

Permalink
feat(poetry-rich-codex): Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Jan 28, 2024
1 parent a148cbb commit 1dc9d3f
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/poetry-rich-codex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Poetry x rich-codex

on:
workflow_call:
secrets:
token:
required: false

jobs:
rich-codex:
if: "!startsWith(github.event.head_commit.message, 'build(rich-codex):')"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out
uses: actions/checkout@v4
with:
token: ${{ secrets.token }}

- name: Install poetry
run: pipx install poetry

- name: Set up python environment
uses: actions/setup-python@v5
with:
cache: poetry
python-version: 3.x

- name: Install dependencies
run: poetry install --sync --with=dev

- name: Run rich-codex
id: rich-codex
run: |
poetry run rich-codex
if [ -f "created.txt" ] || [ -f "deleted.txt" ]; then
echo "has-changes=true" >>$GITHUB_OUTPUT
fi
env:
CLEAN_IMG_PATHS: ./assets/*.svg
FORCE_COLOR: "1"
TERMINAL_WIDTH: "140"
TERMINAL_THEME: MONOKAI
CREATED_FILES: "created.txt"
DELETED_FILES: "deleted.txt"
NO_CONFIRM: "true"
SKIP_GIT_CHECKS: "true"

- name: Add and commit new images
if: steps.rich-codex.outputs.has-changes
shell: bash
run: |
echo "Found changes from running rich-codex, committing ..."
git config --local user.name 'Jan Willhaus [bot]'
git config --local user.email 'bot@janw.xyz'
[ -f "created.txt" ] && git add $(cat created.txt)
[ -f "deleted.txt" ] && git rm $(cat deleted.txt)
git commit -m "build(rich-codex): Update screengrabs"
git push

0 comments on commit 1dc9d3f

Please sign in to comment.