Skip to content

Commit

Permalink
ci: Add rich-codex workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Jan 28, 2024
1 parent fa84ae5 commit db67765
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/rich-codex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Rich-codex

on:
push:
branches-ignore:
- "main"

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

- 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 --no-root --sync

- name: Generate terminal images with rich-codex
uses: ewels/rich-codex@v1
with:
clean_img_paths: ./assets/*.svg
commit_changes: false
error_changes: false

- name: Add and commit new images
shell: bash
run: |
if [ ! -f "created.txt" ] && [ ! -f "deleted.txt" ]; then
exit 0
fi
echo "Found changes from running rich-codex, committing ..."
git config --local user.name 'Jan Willhaus [bot]'
git config --local user.email '[email protected]'
[ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ dist/

.coverage
coverage.xml

rich_codex_*.log
created.txt
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ This project was inspired by [poetry-brew](https://pypi.org/project/poetry-brew/
Run `poetry homebrew-formula --help` for details on how to use it:

<!-- RICH-CODEX fake_command: "poetry homebrew-formula --help" -->
![`poetry run poetry homebrew-formula --help`](.assets/homebrew-formula-help.svg)
![`poetry run poetry homebrew-formula --help --ansi`](.assets/homebrew-formula-help.svg)

0 comments on commit db67765

Please sign in to comment.