mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-03 06:03:25 +00:00
56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Update README.md
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
update_readme:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
|
|
- name: Run markdown-code-runner
|
|
env:
|
|
TERM: dumb
|
|
NO_COLOR: 1
|
|
COLUMNS: 90 # POSIX terminal width for Rich
|
|
TERMINAL_WIDTH: 90 # Typer MAX_WIDTH for help panels
|
|
_TYPER_FORCE_DISABLE_TERMINAL: 1 # Prevent Typer forcing terminal mode in CI
|
|
run: |
|
|
uvx --with . markdown-code-runner README.md
|
|
sed -i 's/[[:space:]]*$//' README.md
|
|
|
|
- name: Commit updated README.md
|
|
id: commit
|
|
run: |
|
|
git add README.md
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
if git diff --quiet && git diff --staged --quiet; then
|
|
echo "No changes in README.md, skipping commit."
|
|
echo "commit_status=skipped" >> $GITHUB_ENV
|
|
else
|
|
git commit -m "Update README.md"
|
|
echo "commit_status=committed" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Push changes
|
|
if: env.commit_status == 'committed'
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ github.head_ref || github.ref_name }}
|