-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(poetry-rich-codex): Add workflow
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |