Add GitHub Actions workflow to update README
This commit is contained in:
parent
8d1ab724c5
commit
33a25a4478
34
.github/workflows/on-file-change.yml
vendored
Normal file
34
.github/workflows/on-file-change.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: Update README from Pytudes
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'py/pytudes.py'
|
||||
|
||||
jobs:
|
||||
build-and-update:
|
||||
runs-on: ubuntu-latest
|
||||
# Added permissions to allow the bot to write to the repo
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Run pytudes.py
|
||||
run: python py/pytudes.py
|
||||
|
||||
- name: Commit and push if README changed
|
||||
run: |
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add README.md
|
||||
# The || exit 0 prevents the workflow from failing if there are no changes
|
||||
git commit -m "docs: auto-update README.md via pytudes.py" || exit 0
|
||||
git push
|
||||
Loading…
x
Reference in New Issue
Block a user