Update ci.yml #7
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 Push | |
on: | |
push: | |
branches: | |
- hyde-gallery | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" # Use the latest Python version | |
- name: Pull the latest changes from remote main branch | |
run: | | |
git pull --no-rebase | |
- name: Run Python script to update README | |
run: | | |
python generate_readme.py | |
- name: Commit changes if any | |
run: | | |
git config --local user.name "github-actions" | |
git config --local user.email "[email protected]" | |
git add README.md | |
if git diff-index --cached --quiet HEAD; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update README with new data" | |
fi | |
- name: Push changes to remote repository | |
if: success() # Ensures the step only runs if previous steps succeeded | |
run: | | |
git push https://github-actions[bot]:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} | |