From db677653671cc0f7496182641aa81a2edb8a9c7d Mon Sep 17 00:00:00 2001 From: Jan Willhaus Date: Sun, 28 Jan 2024 12:15:24 +0100 Subject: [PATCH] ci: Add rich-codex workflow --- .github/workflows/rich-codex.yaml | 52 +++++++++++++++++++++++++++++++ .gitignore | 3 ++ README.md | 2 +- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/rich-codex.yaml diff --git a/.github/workflows/rich-codex.yaml b/.github/workflows/rich-codex.yaml new file mode 100644 index 0000000..e783238 --- /dev/null +++ b/.github/workflows/rich-codex.yaml @@ -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 '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 diff --git a/.gitignore b/.gitignore index 5ba9784..1ee818b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ dist/ .coverage coverage.xml + +rich_codex_*.log +created.txt diff --git a/README.md b/README.md index b0e49b4..f1a4f36 100644 --- a/README.md +++ b/README.md @@ -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: -![`poetry run poetry homebrew-formula --help`](.assets/homebrew-formula-help.svg) +![`poetry run poetry homebrew-formula --help --ansi`](.assets/homebrew-formula-help.svg)