Add auto-format yaml pre-commit hook #115
Workflow file for this run
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
name: Update readme | |
on: | |
pull_request: | |
branches: [main] | |
paths: [data/*] | |
push: | |
branches: [main] | |
paths: [data/*] | |
jobs: | |
make-readme: | |
if: github.repository_owner == 'janosh' # don't run on forks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: pip install pyyaml | |
- name: Run make_readme.py | |
run: python data/make_readme.py | |
- name: Push changes if any | |
run: | | |
if git diff --quiet readme.md; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
git config user.name 'Janosh Riebesell' | |
git config user.email janosh.riebesell@gmail.com | |
git add readme.md | |
git commit -m 'update readme' | |
git push |